Skip to content

Commit 475c599

Browse files
author
Stephane Landelle
committed
Setting a Realm shouldn't override existing Authentication headers, close AsyncHttpClient#448
1 parent 16fa2d8 commit 475c599

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/main/java/com/ning/http/client/providers/netty/NettyAsyncHttpProvider.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -703,20 +703,20 @@ else if (uri.getRawQuery() != null)
703703

704704
switch (realm.getAuthScheme()) {
705705
case BASIC:
706-
nettyRequest.setHeader(HttpHeaders.Names.AUTHORIZATION, AuthenticatorUtils.computeBasicAuthentication(realm));
706+
nettyRequest.addHeader(HttpHeaders.Names.AUTHORIZATION, AuthenticatorUtils.computeBasicAuthentication(realm));
707707
break;
708708
case DIGEST:
709709
if (isNonEmpty(realm.getNonce())) {
710710
try {
711-
nettyRequest.setHeader(HttpHeaders.Names.AUTHORIZATION, AuthenticatorUtils.computeDigestAuthentication(realm));
711+
nettyRequest.addHeader(HttpHeaders.Names.AUTHORIZATION, AuthenticatorUtils.computeDigestAuthentication(realm));
712712
} catch (NoSuchAlgorithmException e) {
713713
throw new SecurityException(e);
714714
}
715715
}
716716
break;
717717
case NTLM:
718718
try {
719-
nettyRequest.setHeader(HttpHeaders.Names.AUTHORIZATION, ntlmEngine.generateType1Msg("NTLM " + domain, authHost));
719+
nettyRequest.addHeader(HttpHeaders.Names.AUTHORIZATION, ntlmEngine.generateType1Msg("NTLM " + domain, authHost));
720720
} catch (NTLMEngineException e) {
721721
IOException ie = new IOException();
722722
ie.initCause(e);
@@ -734,7 +734,7 @@ else if (uri.getRawQuery() != null)
734734
ie.initCause(e);
735735
throw ie;
736736
}
737-
nettyRequest.setHeader(HttpHeaders.Names.AUTHORIZATION, "Negotiate " + challengeHeader);
737+
nettyRequest.addHeader(HttpHeaders.Names.AUTHORIZATION, "Negotiate " + challengeHeader);
738738
break;
739739
case NONE:
740740
break;

0 commit comments

Comments
 (0)