Merged branch 'jetty-9.3.x' into 'jetty-9.4.x'.

This commit is contained in:
Simone Bordet 2016-06-03 18:03:29 +02:00
commit 85b3459af5
2 changed files with 8 additions and 4 deletions

View File

@ -491,6 +491,12 @@ public class HttpClient extends ContainerLifeCycle
protected HttpDestination destinationFor(String scheme, String host, int port) protected HttpDestination destinationFor(String scheme, String host, int port)
{ {
if (!HttpScheme.HTTP.is(scheme) && !HttpScheme.HTTPS.is(scheme) &&
!HttpScheme.WS.is(scheme) && !HttpScheme.WSS.is(scheme))
throw new IllegalArgumentException("Invalid protocol " + scheme);
scheme = scheme.toLowerCase(Locale.ENGLISH);
host = host.toLowerCase(Locale.ENGLISH);
port = normalizePort(scheme, port); port = normalizePort(scheme, port);
Origin origin = new Origin(scheme, host, port); Origin origin = new Origin(scheme, host, port);
@ -530,9 +536,7 @@ public class HttpClient extends ContainerLifeCycle
protected void send(final HttpRequest request, List<Response.ResponseListener> listeners) protected void send(final HttpRequest request, List<Response.ResponseListener> listeners)
{ {
String scheme = request.getScheme().toLowerCase(Locale.ENGLISH); HttpDestination destination = destinationFor(request.getScheme(), request.getHost(), request.getPort());
String host = request.getHost().toLowerCase(Locale.ENGLISH);
HttpDestination destination = destinationFor(scheme, host, request.getPort());
destination.send(request, listeners); destination.send(request, listeners);
} }

View File

@ -271,7 +271,7 @@ public class HttpClientRedirectTest extends AbstractHttpClientServerTest
{ {
baseRequest.setHandled(true); baseRequest.setHandled(true);
response.setStatus(303); response.setStatus(303);
response.setHeader("Location", "ssh://localhost/path"); response.setHeader("Location", "ssh://localhost:" + connector.getLocalPort() + "/path");
} }
}); });