jetty-9: HTTP client: fixed problem when using default ports such as 80 or 443.
This commit is contained in:
parent
6159d6f268
commit
7e30c4ac20
|
@ -311,12 +311,11 @@ public class HttpClient extends ContainerLifeCycle
|
|||
if (!Arrays.asList("http", "https").contains(scheme))
|
||||
throw new IllegalArgumentException("Invalid protocol " + scheme);
|
||||
|
||||
String host = request.host().toLowerCase();
|
||||
int port = request.port();
|
||||
if (port < 0)
|
||||
port = "https".equals(scheme) ? 443 : 80;
|
||||
|
||||
provideDestination(scheme, host, port).send(request, listener);
|
||||
provideDestination(scheme, request.host(), port).send(request, listener);
|
||||
}
|
||||
|
||||
protected void newConnection(HttpDestination destination, Callback<Connection> callback)
|
||||
|
|
|
@ -103,8 +103,9 @@ public class HttpDestination implements Destination, AutoCloseable, Dumpable
|
|||
throw new IllegalArgumentException("Invalid request scheme " + request.scheme() + " for destination " + this);
|
||||
if (!host.equals(request.host()))
|
||||
throw new IllegalArgumentException("Invalid request host " + request.host() + " for destination " + this);
|
||||
if (request.port()>0 && port != request.port())
|
||||
throw new IllegalArgumentException("Invalid request port " + request.port() + " for destination " + this);
|
||||
int port = request.port();
|
||||
if (port >= 0 && this.port != port)
|
||||
throw new IllegalArgumentException("Invalid request port " + port + " for destination " + this);
|
||||
|
||||
RequestPair requestPair = new RequestPair(request, listener);
|
||||
if (client.isRunning())
|
||||
|
|
Loading…
Reference in New Issue