Skip to content

Commit

Permalink
[http] Better handle invalid 401 response (#549)
Browse files Browse the repository at this point in the history
It has been discovered that some servers respond with a 401 without `WWW-Authenticate` header if the original request was sent with creentials. While this is a protocol violation, the user can't fix it, because it is server-side. This PR handles these edge cases more gracefully.

Signed-off-by: Jan N. Klug <[email protected]>
(cherry picked from commit a9dab3d)
  • Loading branch information
J-N-K committed Dec 27, 2023
1 parent f2a165b commit 6f78af1
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void onComplete(Result result) {
logger.trace("Received from '{}': {}", result.getRequest().getURI(), responseToLogString(response));
}
Request request = result.getRequest();
if (result.isFailed()) {
if (response == null || (result.isFailed() && response.getStatus() != 401)) {
logger.debug("Requesting '{}' (method='{}', content='{}') failed: {}", request.getURI(),
request.getMethod(), request.getContent(), result.getFailure().getMessage());
future.complete(null);
Expand Down

0 comments on commit 6f78af1

Please sign in to comment.