1.7.10 - Request sent twice on 401 response #213

Closed
xeus2001 opened this Issue Feb 7, 2013 · 3 comments

Comments

Projects
None yet
3 participants

xeus2001 commented Feb 7, 2013

There is a bug in version 1.7.10 that seems to be fixed in master that causes some trouble for me. Within a middle-ware I'am creating a request using an AWS authorization, setting this directly in the HTTP header via:

requestBuilder.setHeader("authorization", "AWS "+key+":"+signature;);

Now sending this the service reacts with a 401 Unauthorized, what is the expected behave, but instead of receiving the response the asynch client sends automatically another request with the following in the header:

Authorization: Basic Og==

This leads to a complete wrong error message and doubles the amount of request, both is very bad. The problem is fixed in master in the class com.ning.http.client.providers.netty.NettyAsyncHttpProvider around line 2142:

private final class HttpProtocol implements Protocol {
// @override
public void handle(final ChannelHandlerContext ctx, final MessageEvent e) throws Exception {
...
if (statusCode == 401
&& realm != null
&& wwwAuth.size() > 0
&& !future.getAndSetAuth(true)) {

The little "&& realm != null" should make the difference as I've not set a realm for my request, but in version 1.7.10 this line is not contained, it looks like.

            if (statusCode == 401
                    && wwwAuth.size() > 0
                    && !future.getAndSetAuth(true)) {

It would be very nice if you could back port the fix and make a 1.7.11 release.

Thank you

slandelle pushed a commit that referenced this issue Mar 8, 2013

Contributor

slandelle commented Mar 8, 2013

Fixed, thanks for reporting.

@slandelle slandelle closed this Mar 8, 2013

Contributor

rlubke commented Mar 9, 2013

Re-opening so I don't forget to check the grizzly provider for the same issue.

@rlubke rlubke reopened this Mar 9, 2013

Contributor

rlubke commented Mar 10, 2013

Doesn't look like Grizzly is impacted here.

@rlubke rlubke closed this Mar 10, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment