fix: Allow concurrent use for DigestAuth (#69)
fix: Allow concurrent use for DigestAuth
This commit is contained in:
parent
60ec5ad560
commit
cd21842fb6
@ -34,11 +34,15 @@ func (d *DigestAuth) Pass() string {
|
|||||||
|
|
||||||
// Authorize the current request
|
// Authorize the current request
|
||||||
func (d *DigestAuth) Authorize(req *http.Request, method string, path string) {
|
func (d *DigestAuth) Authorize(req *http.Request, method string, path string) {
|
||||||
d.digestParts["uri"] = path
|
parts := make(map[string]string, len(d.digestParts)+4)
|
||||||
d.digestParts["method"] = method
|
for k, v := range d.digestParts {
|
||||||
d.digestParts["username"] = d.user
|
parts[k] = v
|
||||||
d.digestParts["password"] = d.pw
|
}
|
||||||
req.Header.Set("Authorization", getDigestAuthorization(d.digestParts))
|
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 {
|
func digestParts(resp *http.Response) map[string]string {
|
||||||
|
Loading…
Reference in New Issue
Block a user