shinseongsu opened a new pull request, #3327:
URL: https://github.com/apache/httpcomponents-client/pull/3327

   After 3423165b8 a single malformed `WWW-Authenticate` / `Proxy-Authenticate` 
header makes `extractChallengeMap` return an empty map for the whole response, 
so valid challenges in the other headers are ignored. In 5.6.x only the bad 
header was skipped.
   
   For example, with a server sending
   
   ```
   WWW-Authenticate: Basic realm="x"
   WWW-Authenticate: Bearer, Digest realm="y", nonce="n"
   ```
   
   The second header fails to parse, and with credentials for Basic configured 
the client returns the 401 instead of retrying with `Authorization: Basic ...`. 
Same on classic and async. 5.6.5 gets 200, 5.7-beta1 and master get 401.
   
   The empty map is also `Collections.emptyMap()`, which `handleResponse` later 
tries to `put` the Authentication-Info challenge into, so a 200 response with 
`Authentication-Info` and a malformed challenge header throws 
`UnsupportedOperationException` (AuthenticationHandler line 255).
   
   This parses each header on its own again, skips only the ones that fail, and 
returns a mutable map. Added two tests to `TestAuthenticationHandler`; both 
fail on master. `httpclient5` tests pass (1248).
   
   Note: `Bearer, Digest realm=...` is a valid challenge list per RFC 9110, 
section 11.6.1, and `AuthChallengeParser` rejects it because it does not expect 
a comma right after a scheme with no parameters. That is an older issue, also 
in 5.6.x, so I left it out of this change. I can send a separate PR for it if 
you want.
   


-- 
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]

Reply via email to