Skip to content

Commit 9a34bbd

Browse files
author
oleksiys
committed
[1.9.x] + fix issue #782
#782 "Query param are getting lost with Grizzly AHC"
1 parent a8b89b4 commit 9a34bbd

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

src/main/java/com/ning/http/client/providers/grizzly/GrizzlyAsyncHttpProvider.java

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -868,19 +868,28 @@ private boolean sendAsGrizzlyRequest(final Request request,
868868
}
869869
final ProxyServer proxy = ProxyUtils.getProxyServer(config, request);
870870
final boolean useProxy = proxy != null;
871+
871872
if (useProxy) {
872-
if ((secure || httpCtx.isWSRequest) && !httpCtx.isTunnelEstablished(connection)) {
873-
secure = false;
874-
httpCtx.establishingTunnel = true;
875-
builder.method(Method.CONNECT);
876-
builder.uri(AsyncHttpProviderUtils.getAuthority(uri));
877-
} else if ((secure || httpCtx.isWSRequest) && config.isUseRelativeURIsWithConnectProxies()){
878-
builder.uri(getNonEmptyPath(uri));
873+
if (secure || httpCtx.isWSRequest) { // TUNNELING?
874+
if (!httpCtx.isTunnelEstablished(connection)) {
875+
secure = false;
876+
httpCtx.establishingTunnel = true;
877+
builder.method(Method.CONNECT);
878+
builder.uri(AsyncHttpProviderUtils.getAuthority(uri));
879+
} else {
880+
if (config.isUseRelativeURIsWithConnectProxies()) {
881+
builder.uri(getNonEmptyPath(uri));
882+
builder.query(uri.getQuery());
883+
} else {
884+
builder.uri(uri.toUrl());
885+
}
886+
}
879887
} else {
880888
builder.uri(uri.toUrl());
881889
}
882890
} else {
883891
builder.uri(getNonEmptyPath(uri));
892+
builder.query(uri.getQuery());
884893
}
885894

886895
final BodyHandler bodyHandler = isPayloadAllowed(method) ?
@@ -916,10 +925,6 @@ private boolean sendAsGrizzlyRequest(final Request request,
916925

917926
ctx.notifyDownstream(new SwitchingSSLFilter.SSLSwitchingEvent(secure, connection));
918927

919-
if (!useProxy && !httpCtx.isWSRequest) {
920-
requestPacket.setQueryString(uri.getQuery());
921-
//addQueryString(request, requestPacket);
922-
}
923928
addHeaders(request, requestPacket);
924929
addCookies(request, requestPacket);
925930
addAuthorizationHeader(request, requestPacket);

0 commit comments

Comments
 (0)