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]>
  • Loading branch information
J-N-K authored Dec 27, 2023
1 parent b7d7d9a commit a9dab3d
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 a9dab3d

Please sign in to comment.