From 6300c02f295ff7c19644fe86b873978778252479 Mon Sep 17 00:00:00 2001 From: Chris Novakovic Date: Wed, 5 Oct 2022 19:27:22 +0100 Subject: [PATCH] agent/s3util: log to correct logger in headBucketTransport.RoundTrip When the delegate responds with a status code indicating a redirect but no `Location` response header, the log message recording the status code override is sent to the package-wide mock logger defined in `test_s3util.go`, causing the message to be lost. Instead, send the message to the real logger referenced in the `headBucketTransport` struct. Fixes #473. --- agent/s3util/s3util_dep.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/agent/s3util/s3util_dep.go b/agent/s3util/s3util_dep.go index 978f9916c..a9b916ba5 100644 --- a/agent/s3util/s3util_dep.go +++ b/agent/s3util/s3util_dep.go @@ -116,7 +116,7 @@ func (trans headBucketTransport) RoundTrip(request *http.Request) (resp *http.Re resp, err = trans.delegate.RoundTrip(request) if err == nil && resp != nil && goHttpClientWillFollowRedirect(resp.StatusCode) { if resp.Header != nil && resp.Header.Get("Location") == "" && resp.Header.Get(bucketRegionHeader) != "" { - logger.Debugf("redirect response missing Location header, overriding status code") + trans.logger.Debugf("redirect response missing Location header, overriding status code") resp.StatusCode = 200 } }