@@ -492,12 +492,16 @@ public void operationComplete(ChannelFuture cf) {
492
492
}
493
493
494
494
}
495
+
496
+ private static boolean isProxyServer (AsyncHttpClientConfig config , Request request ) {
497
+ return request .getProxyServer () != null || config .getProxyServer () != null ;
498
+ }
495
499
496
500
protected final static HttpRequest buildRequest (AsyncHttpClientConfig config , Request request , URI uri ,
497
501
boolean allowConnect , ChannelBuffer buffer ) throws IOException {
498
502
499
503
String method = request .getMethod ();
500
- if (allowConnect && (( request . getProxyServer () != null || config . getProxyServer () != null ) && HTTPS .equalsIgnoreCase (uri .getScheme ()))) {
504
+ if (allowConnect && (isProxyServer ( config , request ) && HTTPS .equalsIgnoreCase (uri .getScheme ()))) {
501
505
method = HttpMethod .CONNECT .toString ();
502
506
}
503
507
return construct (config , request , new HttpMethod (method ), uri , buffer );
@@ -520,9 +524,14 @@ private static HttpRequest construct(AsyncHttpClientConfig config,
520
524
if (m .equals (HttpMethod .CONNECT )) {
521
525
nettyRequest = new DefaultHttpRequest (HttpVersion .HTTP_1_0 , m , AsyncHttpProviderUtils .getAuthority (uri ));
522
526
} else {
523
- StringBuilder path = new StringBuilder (uri .getRawPath ());
524
- if (uri .getQuery () != null ) {
525
- path .append ("?" ).append (uri .getRawQuery ());
527
+ StringBuilder path = null ;
528
+ if (isProxyServer (config , request ))
529
+ path = new StringBuilder (uri .toString ());
530
+ else {
531
+ path = new StringBuilder (uri .getRawPath ());
532
+ if (uri .getQuery () != null ) {
533
+ path .append ("?" ).append (uri .getRawQuery ());
534
+ }
526
535
}
527
536
nettyRequest = new DefaultHttpRequest (HttpVersion .HTTP_1_1 , m , path .toString ());
528
537
}
0 commit comments