fix: Allow concurrent use for DigestAuth (#69)

fix: Allow concurrent use for DigestAuth
This commit is contained in:
yyeltsyn 2023-02-03 20:59:54 +03:00 committed by GitHub
parent 60ec5ad560
commit cd21842fb6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -34,11 +34,15 @@ func (d *DigestAuth) Pass() string {
// Authorize the current request
func (d *DigestAuth) Authorize(req *http.Request, method string, path string) {
d.digestParts["uri"] = path
d.digestParts["method"] = method
d.digestParts["username"] = d.user
d.digestParts["password"] = d.pw
req.Header.Set("Authorization", getDigestAuthorization(d.digestParts))
parts := make(map[string]string, len(d.digestParts)+4)
for k, v := range d.digestParts {
parts[k] = v
}
parts["uri"] = path
parts["method"] = method
parts["username"] = d.user
parts["password"] = d.pw
req.Header.Set("Authorization", getDigestAuthorization(parts))
}
func digestParts(resp *http.Response) map[string]string {