shinseongsu commented on code in PR #3327:
URL:
https://github.com/apache/httpcomponents-client/pull/3327#discussion_r4746921414
##########
httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/AuthenticationHandler.java:
##########
@@ -164,37 +164,31 @@ public boolean isChallengeExpected(final AuthExchange
authExchange) {
return authScheme != null && authScheme.isChallengeExpected();
}
- private Map<String, AuthChallenge> extractChallengeMap(
- final ChallengeType challengeType,
- final HttpResponse response) throws ParseException {
- final List<AuthChallenge> authChallenges = new ArrayList<>(10);
- MessageSupport.parseHeadersStrict(
- response,
- challengeType == ChallengeType.PROXY ?
HttpHeaders.PROXY_AUTHENTICATE : HttpHeaders.WWW_AUTHENTICATE,
- (buffer, cursor) ->
- parser.parse(challengeType, authChallenges, buffer,
cursor));
-
- return authChallenges.stream()
- .collect(Collectors.toMap(
- c -> c.getSchemeName().toLowerCase(Locale.ROOT),
- c -> c,
- (c1, c2) -> c1));
- }
-
public Map<String, AuthChallenge> extractChallengeMap(
final ChallengeType challengeType,
final HttpResponse response,
final HttpClientContext context) {
- try {
- return extractChallengeMap(challengeType, response);
- } catch (final ParseException ex) {
- if (LOG.isWarnEnabled()) {
- final HttpClientContext clientContext =
HttpClientContext.cast(context);
- final String exchangeId = clientContext.getExchangeId();
- LOG.warn("{} Malformed challenge", exchangeId);
+ final Map<String, AuthChallenge> challengeMap = new HashMap<>();
Review Comment:
@ok2c Thanks, that reads much cleaner. Applied it as is and squashed it into
the commit.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]