Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
keshav-725 committed Apr 13, 2023
1 parent ea56eb8 commit 159092a
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public HttpResponse evaluateDigestMechanism(String uri) throws Exception {
HttpRequest request;
request = createDigestRequest(uri);

if(!(lastURI.equals(uri))){
if(lastURI==null || !(lastURI.equals(uri))){
lastURI = uri;
}

Expand Down Expand Up @@ -284,6 +284,7 @@ public HttpResponse evaluateNoAuthMechanism(String uri) throws Exception{
.build();

HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString());
return response;
}

public HttpResponse connect(String uri) throws Exception {
Expand Down Expand Up @@ -314,10 +315,10 @@ public HttpResponse connect(String uri) throws Exception {

String authHeader = response.headers().allValues("www-authenticate").get(0);

if (authHeader.toLowerCase().startsWith("Basic ")) {
if (authHeader.toLowerCase().startsWith("basic")) {
response = evaluateBasicMechanism(uri);
previousMechanism = "basic";
} else if (authHeader.toLowerCase().startsWith("Digest ")) {
} else if (authHeader.toLowerCase().startsWith("digest")) {
updateAuthParams(authHeader);
response = evaluateDigestMechanism(uri);
previousMechanism = "digest";
Expand Down

0 comments on commit 159092a

Please sign in to comment.