diff options
author | Haakon Dybdahl <dybdahl@yahoo-inc.com> | 2016-09-21 08:33:36 +0200 |
---|---|---|
committer | Haakon Dybdahl <dybdahl@yahoo-inc.com> | 2016-09-21 08:33:36 +0200 |
commit | 562d90334373274ba0b9904fcb59c7cbd120d6c3 (patch) | |
tree | 636ac2faf1817836d2f5f2517fc84a69f85d8799 /vespa-http-client/src/main/java/com | |
parent | d72e94e51b667329c7aad73ffef1c2a13ddb2beb (diff) |
Allow servername prefixed with http.
Diffstat (limited to 'vespa-http-client/src/main/java/com')
-rw-r--r-- | vespa-http-client/src/main/java/com/yahoo/vespa/http/client/config/Endpoint.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/config/Endpoint.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/config/Endpoint.java index b23480f9251..6c2e162f15b 100644 --- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/config/Endpoint.java +++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/config/Endpoint.java @@ -41,7 +41,15 @@ public final class Endpoint { private final boolean useSsl; private static final int DEFAULT_PORT = 4080; private Endpoint(String hostname, int port, boolean useSsl) { - this.hostname = hostname; + if (hostname.startsWith("https://")) { + throw new RuntimeException("Hostname should be name of machine, not prefixed with protocol (https://)"); + } + // A lot of people put http:// before the servername, let us allow that. + if (hostname.startsWith("http://")) { + this.hostname = hostname.replaceFirst("http://", ""); + } else { + this.hostname = hostname; + } this.port = port; this.useSsl = useSsl; } |