Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions config/http_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -1067,6 +1067,18 @@ func (rt *oauth2RoundTripper) newOauth2TokenSource(req *http.Request, clientCred
}

func (rt *oauth2RoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
if isCrossHostRedirect(req) {
// Bypass the OAuth2 transport so no token is attached. Read Base under
// the lock to avoid a data race with concurrent reconfigurations.
rt.mtx.RLock()
base := rt.lastRT.Base
rt.mtx.RUnlock()
if base == nil {
base = http.DefaultTransport
}
return base.RoundTrip(req)
}

var (
secret string
needsInit bool
Expand Down Expand Up @@ -1110,9 +1122,6 @@ func (rt *oauth2RoundTripper) RoundTrip(req *http.Request) (*http.Response, erro
rt.mtx.RLock()
currentRT := rt.lastRT
rt.mtx.RUnlock()
if isCrossHostRedirect(req) {
return currentRT.Base.RoundTrip(req)
}
return currentRT.RoundTrip(req)
}

Expand Down
Loading