@@ -986,7 +986,9 @@ private <T> ListenableFuture<T> doConnect(final Request request, final AsyncHand
986
986
throw new IOException ("Closed" );
987
987
}
988
988
989
- if (request .getUrl ().startsWith (WEBSOCKET ) && !validateWebSocketRequest (request , asyncHandler )) {
989
+ URI uri = useRawUrl ? request .getRawURI () : request .getURI ();
990
+
991
+ if (uri .getScheme ().startsWith (WEBSOCKET ) && !validateWebSocketRequest (request , asyncHandler )) {
990
992
throw new IOException ("WebSocket method must be a GET" );
991
993
}
992
994
@@ -995,8 +997,6 @@ private <T> ListenableFuture<T> doConnect(final Request request, final AsyncHand
995
997
boolean resultOfAConnect = f != null && f .getNettyRequest () != null && f .getNettyRequest ().getMethod ().equals (HttpMethod .CONNECT );
996
998
boolean useProxy = proxyServer != null && !resultOfAConnect ;
997
999
998
- URI uri = useRawUrl ? request .getRawURI () : request .getURI ();
999
-
1000
1000
ChannelBuffer bufferedBytes = null ;
1001
1001
if (f != null && f .getRequest ().getFile () == null && !f .getNettyRequest ().getMethod ().getName ().equals (HttpMethod .CONNECT .getName ())) {
1002
1002
bufferedBytes = f .getNettyRequest ().getContent ();
@@ -1069,7 +1069,7 @@ private <T> ListenableFuture<T> doConnect(final Request request, final AsyncHand
1069
1069
}
1070
1070
1071
1071
ChannelFuture channelFuture ;
1072
- ClientBootstrap bootstrap = (request .getUrl ().startsWith (WEBSOCKET ) && !useProxy ) ? (useSSl ? secureWebSocketBootstrap : webSocketBootstrap ) : (useSSl ? secureBootstrap
1072
+ ClientBootstrap bootstrap = (request .getURI (). getScheme ().startsWith (WEBSOCKET ) && !useProxy ) ? (useSSl ? secureWebSocketBootstrap : webSocketBootstrap ) : (useSSl ? secureBootstrap
1073
1073
: plainBootstrap );
1074
1074
bootstrap .setOption ("connectTimeoutMillis" , config .getConnectionTimeoutInMs ());
1075
1075
@@ -1977,7 +1977,7 @@ private boolean redirect(Request request, NettyResponseFuture<?> future, HttpRes
1977
1977
final String initialPoolKey = getPoolKey (future );
1978
1978
future .setURI (uri );
1979
1979
String newUrl = uri .toString ();
1980
- if (request .getUrl ().startsWith (WEBSOCKET )) {
1980
+ if (request .getURI (). getScheme ().startsWith (WEBSOCKET )) {
1981
1981
newUrl = newUrl .replace (HTTP , WEBSOCKET );
1982
1982
}
1983
1983
@@ -2128,7 +2128,7 @@ public void handle(final ChannelHandlerContext ctx, final MessageEvent e) throws
2128
2128
String realmURI = computeRealmURI (newRealm , request .getURI ());
2129
2129
final Realm nr = new Realm .RealmBuilder ().clone (newRealm ).setUri (realmURI ).build ();
2130
2130
2131
- log .debug ("Sending authentication to {}" , request .getUrl ());
2131
+ log .debug ("Sending authentication to {}" , request .getURI ());
2132
2132
AsyncCallable ac = new AsyncCallable (future ) {
2133
2133
public Object call () throws Exception {
2134
2134
drainChannel (ctx , future );
@@ -2156,7 +2156,7 @@ public Object call() throws Exception {
2156
2156
List <String > proxyAuth = getAuthorizationToken (response .getHeaders (), HttpHeaders .Names .PROXY_AUTHENTICATE );
2157
2157
if (statusCode == 407 && realm != null && !proxyAuth .isEmpty () && !future .getAndSetAuth (true )) {
2158
2158
2159
- log .debug ("Sending proxy authentication to {}" , request .getUrl ());
2159
+ log .debug ("Sending proxy authentication to {}" , request .getURI ());
2160
2160
2161
2161
future .setState (NettyResponseFuture .STATE .NEW );
2162
2162
Realm newRealm = null ;
@@ -2188,8 +2188,9 @@ public Object call() throws Exception {
2188
2188
}
2189
2189
2190
2190
try {
2191
- log .debug ("Connecting to proxy {} for scheme {}" , proxyServer , request .getUrl ());
2192
- upgradeProtocol (ctx .getChannel ().getPipeline (), request .getURI ().getScheme ());
2191
+ String scheme = request .getURI ().getScheme ();
2192
+ log .debug ("Connecting to proxy {} for scheme {}" , proxyServer , scheme );
2193
+ upgradeProtocol (ctx .getChannel ().getPipeline (), scheme );
2193
2194
} catch (Throwable ex ) {
2194
2195
abort (future , ex );
2195
2196
}
0 commit comments