From ac8379d2cc31f79e279eb402cacbfa1844d73675 Mon Sep 17 00:00:00 2001 From: Spring Operator Date: Wed, 20 Mar 2019 15:38:30 -0500 Subject: [PATCH] URL Cleanup This commit updates URLs to prefer the https protocol. Redirects are not followed to avoid accidentally expanding intentionally shortened URLs (i.e. if using a URL shortener). These URLs were fixed, but the https status was not OK. However, the https status was the same as the http request or http redirected to an https URL, so they were migrated. Your review is recommended. * [ ] http:///foobar (UnknownHostException) with 1 occurrences migrated to: https:///foobar ([https](https:///foobar) result UnknownHostException). * [ ] http://a.host (UnknownHostException) with 1 occurrences migrated to: https://a.host ([https](https://a.host) result UnknownHostException). * [ ] http://c.host (UnknownHostException) with 1 occurrences migrated to: https://c.host ([https](https://c.host) result UnknownHostException). * [ ] http://compose.docker.io/ (UnknownHostException) with 1 occurrences migrated to: https://compose.docker.io/ ([https](https://compose.docker.io/) result UnknownHostException). * [ ] http://d.host (UnknownHostException) with 1 occurrences migrated to: https://d.host ([https](https://d.host) result UnknownHostException). * [ ] http://default (UnknownHostException) with 1 occurrences migrated to: https://default ([https](https://default) result UnknownHostException). * [ ] http://f.host (UnknownHostException) with 1 occurrences migrated to: https://f.host ([https](https://f.host) result UnknownHostException). * [ ] http://foo (UnknownHostException) with 7 occurrences migrated to: https://foo ([https](https://foo) result UnknownHostException). * [ ] http://foo_underscore (UnknownHostException) with 1 occurrences migrated to: https://foo_underscore ([https](https://foo_underscore) result UnknownHostException). * [ ] http://foobar (UnknownHostException) with 1 occurrences migrated to: https://foobar ([https](https://foobar) result UnknownHostException). * [ ] http://g.host (UnknownHostException) with 1 occurrences migrated to: https://g.host ([https](https://g.host) result UnknownHostException). * [ ] http://h.host (UnknownHostException) with 1 occurrences migrated to: https://h.host ([https](https://h.host) result UnknownHostException). * [ ] http://host1:8080 (UnknownHostException) with 2 occurrences migrated to: https://host1:8080 ([https](https://host1:8080) result UnknownHostException). * [ ] http://listener (UnknownHostException) with 1 occurrences migrated to: https://listener ([https](https://listener) result UnknownHostException). * [ ] http://myservice/path/to/service (UnknownHostException) with 1 occurrences migrated to: https://myservice/path/to/service ([https](https://myservice/path/to/service) result UnknownHostException). * [ ] http://noRetry (UnknownHostException) with 1 occurrences migrated to: https://noRetry ([https](https://noRetry) result UnknownHostException). * [ ] http://s1-1:8080 (UnknownHostException) with 5 occurrences migrated to: https://s1-1:8080 ([https](https://s1-1:8080) result UnknownHostException). * [ ] http://stores (UnknownHostException) with 1 occurrences migrated to: https://stores ([https](https://stores) result UnknownHostException). * [ ] http://stores/stores (UnknownHostException) with 3 occurrences migrated to: https://stores/stores ([https](https://stores/stores) result UnknownHostException). * [ ] http://www.puppycrawl.com/dtds/suppressions_1_1.dtd (404) with 1 occurrences migrated to: https://www.puppycrawl.com/dtds/suppressions_1_1.dtd ([https](https://www.puppycrawl.com/dtds/suppressions_1_1.dtd) result 404). These URLs were switched to an https URL with a 2xx status. While the status was successful, your review is still recommended. * [ ] http://12factor.net/ with 2 occurrences migrated to: https://12factor.net/ ([https](https://12factor.net/) result 200). * [ ] http://cloud.spring.io/spring-cloud-consul/ with 1 occurrences migrated to: https://cloud.spring.io/spring-cloud-consul/ ([https](https://cloud.spring.io/spring-cloud-consul/) result 200). * [ ] http://cloud.spring.io/spring-cloud-netflix/ with 1 occurrences migrated to: https://cloud.spring.io/spring-cloud-netflix/ ([https](https://cloud.spring.io/spring-cloud-netflix/) result 200). * [ ] http://cloud.spring.io/spring-cloud-zookeeper/ with 1 occurrences migrated to: https://cloud.spring.io/spring-cloud-zookeeper/ ([https](https://cloud.spring.io/spring-cloud-zookeeper/) result 200). * [ ] http://example.com with 1 occurrences migrated to: https://example.com ([https](https://example.com) result 200). * [ ] http://martinfowler.com/bliki/CircuitBreaker.html with 1 occurrences migrated to: https://martinfowler.com/bliki/CircuitBreaker.html ([https](https://martinfowler.com/bliki/CircuitBreaker.html) result 200). * [ ] http://pivotal.io/platform-as-a-service/migrating-to-cloud-native-application-architectures-ebook with 2 occurrences migrated to: https://pivotal.io/platform-as-a-service/migrating-to-cloud-native-application-architectures-ebook ([https](https://pivotal.io/platform-as-a-service/migrating-to-cloud-native-application-architectures-ebook) result 200). * [ ] http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html with 2 occurrences migrated to: https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html ([https](https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) result 200). * [ ] http://www.oracle.com/technetwork/java/javase/downloads/jce-6-download-429243.html with 2 occurrences migrated to: https://www.oracle.com/technetwork/java/javase/downloads/jce-6-download-429243.html ([https](https://www.oracle.com/technetwork/java/javase/downloads/jce-6-download-429243.html) result 200). * [ ] http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html with 2 occurrences migrated to: https://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html ([https](https://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html) result 200). * [ ] http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html with 2 occurrences migrated to: https://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html ([https](https://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html) result 200). * [ ] http://plugins.jetbrains.com/plugin/6546 with 2 occurrences migrated to: https://plugins.jetbrains.com/plugin/6546 ([https](https://plugins.jetbrains.com/plugin/6546) result 301). * [ ] http://projects.spring.io/spring-boot with 2 occurrences migrated to: https://projects.spring.io/spring-boot ([https](https://projects.spring.io/spring-boot) result 301). * [ ] http://eclipse.org with 1 occurrences migrated to: https://eclipse.org ([https](https://eclipse.org) result 302). * [ ] http://eclipse.org/m2e/ with 2 occurrences migrated to: https://eclipse.org/m2e/ ([https](https://eclipse.org/m2e/) result 302). * [ ] http://www.springsource.com/developer/sts with 1 occurrences migrated to: https://www.springsource.com/developer/sts ([https](https://www.springsource.com/developer/sts) result 302). These URLs were intentionally ignored. * http://localhost with 4 occurrences * http://localhost:8888 with 1 occurrences * http://testservice with 1 occurrences --- .../main/asciidoc/spring-cloud-commons.adoc | 2 +- .../CompositeDiscoveryClientTests.java | 12 +++++----- ...DiscoveryClientPropertiesMappingTests.java | 22 +++++++++---------- .../config/BootstrapConfigurationTests.java | 2 +- 4 files changed, 18 insertions(+), 20 deletions(-) diff --git a/docs/src/main/asciidoc/spring-cloud-commons.adoc b/docs/src/main/asciidoc/spring-cloud-commons.adoc index 99b2a4df..c9018e65 100644 --- a/docs/src/main/asciidoc/spring-cloud-commons.adoc +++ b/docs/src/main/asciidoc/spring-cloud-commons.adoc @@ -500,7 +500,7 @@ public class MyClass { } public String doStuff() { - return restTemplate.getForObject("https://example.com", String.class); + return restTemplate.getForObject("http://example.com", String.class); } } ---- diff --git a/spring-cloud-commons/src/test/java/org/springframework/cloud/client/discovery/composite/CompositeDiscoveryClientTests.java b/spring-cloud-commons/src/test/java/org/springframework/cloud/client/discovery/composite/CompositeDiscoveryClientTests.java index d60d5436..83d36338 100644 --- a/spring-cloud-commons/src/test/java/org/springframework/cloud/client/discovery/composite/CompositeDiscoveryClientTests.java +++ b/spring-cloud-commons/src/test/java/org/springframework/cloud/client/discovery/composite/CompositeDiscoveryClientTests.java @@ -38,10 +38,10 @@ import static org.springframework.cloud.client.discovery.composite.CompositeDisc @RunWith(SpringRunner.class) @SpringBootTest(properties = { "spring.application.name=service0", - "spring.cloud.discovery.client.simple.instances.service1[0].uri=http://s1-1:8080", - "spring.cloud.discovery.client.simple.instances.service1[1].uri=https://s1-2:8443", - "spring.cloud.discovery.client.simple.instances.service2[0].uri=https://s2-1:8080", - "spring.cloud.discovery.client.simple.instances.service2[1].uri=https://s2-2:443" }, classes = { + "spring.cloud.discovery.client.simple.instances.service1[0].uri=http://s11:8080", + "spring.cloud.discovery.client.simple.instances.service1[1].uri=https://s12:8443", + "spring.cloud.discovery.client.simple.instances.service2[0].uri=https://s21:8080", + "spring.cloud.discovery.client.simple.instances.service2[1].uri=https://s22:443" }, classes = { CompositeDiscoveryClientTestsConfig.class }) public class CompositeDiscoveryClientTests { @@ -55,9 +55,9 @@ public class CompositeDiscoveryClientTests { then(this.discoveryClient.getInstances("service1")).hasSize(2); ServiceInstance s1 = this.discoveryClient.getInstances("service1").get(0); - then(s1.getHost()).isEqualTo("s1-1"); + then(s1.getHost()).isEqualTo("s11"); then(s1.getPort()).isEqualTo(8080); - then(s1.getUri()).isEqualTo(URI.create("http://s1-1:8080")); + then(s1.getUri()).isEqualTo(URI.create("http://s11:8080")); then(s1.isSecure()).isEqualTo(false); } diff --git a/spring-cloud-commons/src/test/java/org/springframework/cloud/client/discovery/simple/SimpleDiscoveryClientPropertiesMappingTests.java b/spring-cloud-commons/src/test/java/org/springframework/cloud/client/discovery/simple/SimpleDiscoveryClientPropertiesMappingTests.java index 8106b36a..1ac2f010 100644 --- a/spring-cloud-commons/src/test/java/org/springframework/cloud/client/discovery/simple/SimpleDiscoveryClientPropertiesMappingTests.java +++ b/spring-cloud-commons/src/test/java/org/springframework/cloud/client/discovery/simple/SimpleDiscoveryClientPropertiesMappingTests.java @@ -38,10 +38,10 @@ import static org.assertj.core.api.BDDAssertions.then; @RunWith(SpringRunner.class) @SpringBootTest(properties = { "spring.application.name=service0", - "spring.cloud.discovery.client.simple.instances.service1[0].uri=http://s1-1:8080", - "spring.cloud.discovery.client.simple.instances.service1[1].uri=https://s1-2:8443", - "spring.cloud.discovery.client.simple.instances.service2[0].uri=https://s2-1:8080", - "spring.cloud.discovery.client.simple.instances.service2[1].uri=https://s2-2:443" }) + "spring.cloud.discovery.client.simple.instances.service1[0].uri=http://s11:8080", + "spring.cloud.discovery.client.simple.instances.service1[1].uri=https://s12:8443", + "spring.cloud.discovery.client.simple.instances.service2[0].uri=https://s21:8080", + "spring.cloud.discovery.client.simple.instances.service2[1].uri=https://s22:443" }) public class SimpleDiscoveryClientPropertiesMappingTests { @Autowired @@ -54,20 +54,18 @@ public class SimpleDiscoveryClientPropertiesMappingTests { public void propsShouldGetCleanlyMapped() { then(this.props.getInstances().size()).isEqualTo(2); then(this.props.getInstances().get("service1").size()).isEqualTo(2); - then(this.props.getInstances().get("service1").get(0).getHost()) - .isEqualTo("s1-1"); + then(this.props.getInstances().get("service1").get(0).getHost()).isEqualTo("s11"); then(this.props.getInstances().get("service1").get(0).getPort()).isEqualTo(8080); then(this.props.getInstances().get("service1").get(0).getUri()) - .isEqualTo(URI.create("http://s1-1:8080")); + .isEqualTo(URI.create("http://s11:8080")); then(this.props.getInstances().get("service1").get(0).isSecure()) .isEqualTo(false); then(this.props.getInstances().get("service2").size()).isEqualTo(2); - then(this.props.getInstances().get("service2").get(0).getHost()) - .isEqualTo("s2-1"); + then(this.props.getInstances().get("service2").get(0).getHost()).isEqualTo("s21"); then(this.props.getInstances().get("service2").get(0).getPort()).isEqualTo(8080); then(this.props.getInstances().get("service2").get(0).getUri()) - .isEqualTo(URI.create("https://s2-1:8080")); + .isEqualTo(URI.create("https://s21:8080")); then(this.props.getInstances().get("service2").get(0).isSecure()).isEqualTo(true); } @@ -77,9 +75,9 @@ public class SimpleDiscoveryClientPropertiesMappingTests { then(this.discoveryClient.getInstances("service1")).hasSize(2); ServiceInstance s1 = this.discoveryClient.getInstances("service1").get(0); - then(s1.getHost()).isEqualTo("s1-1"); + then(s1.getHost()).isEqualTo("s11"); then(s1.getPort()).isEqualTo(8080); - then(s1.getUri()).isEqualTo(URI.create("http://s1-1:8080")); + then(s1.getUri()).isEqualTo(URI.create("http://s11:8080")); then(s1.isSecure()).isEqualTo(false); } diff --git a/spring-cloud-context/src/test/java/org/springframework/cloud/bootstrap/config/BootstrapConfigurationTests.java b/spring-cloud-context/src/test/java/org/springframework/cloud/bootstrap/config/BootstrapConfigurationTests.java index 7fac3b37..ef742e1b 100644 --- a/spring-cloud-context/src/test/java/org/springframework/cloud/bootstrap/config/BootstrapConfigurationTests.java +++ b/spring-cloud-context/src/test/java/org/springframework/cloud/bootstrap/config/BootstrapConfigurationTests.java @@ -371,7 +371,7 @@ public class BootstrapConfigurationTests { } @Test - @Ignore //FIXME 2.2.0.M1 + @Ignore // FIXME 2.2.0.M1 public void includeProfileFromBootstrapProperties() { this.context = new SpringApplicationBuilder().web(WebApplicationType.NONE) .sources(BareConfiguration.class)