Skip to content

Commit 3ac60bd

Browse files
committed
Remove digest_transport.go wrapper
Reference: #4599 (review) Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
1 parent c54d1ea commit 3ac60bd

File tree

2 files changed

+14
-32
lines changed

2 files changed

+14
-32
lines changed

lib/netext/httpext/digest_transport.go

Lines changed: 0 additions & 31 deletions
This file was deleted.

lib/netext/httpext/request.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"time"
1515

1616
"github.com/Azure/go-ntlmssp"
17+
"github.com/icholy/digest"
1718
"github.com/sirupsen/logrus"
1819
"gopkg.in/guregu/null.v3"
1920

@@ -213,7 +214,19 @@ func MakeRequest(ctx context.Context, state *lib.State, preq *ParsedHTTPRequest)
213214
return status == 401 || originalResponseCallback(status)
214215
}
215216
}
216-
transport = digestTransport{originalTransport: transport}
217+
218+
username := preq.URL.u.User.Username()
219+
password, _ := preq.URL.u.User.Password()
220+
221+
// Remove the user data from the URL to avoid sending the authorization
222+
// header for basic auth
223+
preq.URL.u.User = nil
224+
225+
transport = &digest.Transport{
226+
Username: username,
227+
Password: password,
228+
Transport: transport,
229+
}
217230
} else if preq.Auth == "ntlm" {
218231
// The first response of NTLM auth may be a 401 error.
219232
if tracerTransport.responseCallback != nil {

0 commit comments

Comments
 (0)