reqFlags := []string{}
unauthorized := false
+
+ authCacheM.Lock()
+ if creds, ok := authCache[req.URL.Host]; ok {
+ req.SetBasicAuth(creds[0], creds[1])
+ unauthorized = true
+ }
+ authCacheM.Unlock()
+
Retry:
resp, err := transport.RoundTrip(req)
if err != nil {
delete(authCache, req.URL.Host)
} else {
unauthorized = true
- if creds, ok := authCache[req.URL.Host]; ok {
- authCacheM.Unlock()
- req.SetBasicAuth(creds[0], creds[1])
- goto Retry
- }
}
fifos.SinkOther <- fmt.Sprintf("%s\tauthorization required", req.URL.Host)
user, pass, err := authDialog(host, resp.Header.Get("WWW-Authenticate"))