Merge branch '21705-go-deps'
[arvados.git] / sdk / go / arvados / client.go
index 7bc3d5bc420404559939247b04cb4b7849c620d6..ead66c3d408a2212cbfb6693bf4e03711f913a4d 100644 (file)
@@ -32,6 +32,7 @@ import (
 
        "git.arvados.org/arvados.git/sdk/go/httpserver"
        "github.com/hashicorp/go-retryablehttp"
+       "github.com/sirupsen/logrus"
 )
 
 // A Client is an HTTP client with an API endpoint and a set of
@@ -82,6 +83,9 @@ type Client struct {
        // filesystem size.
        DiskCacheSize ByteSizeOrPercent
 
+       // Where to write debug logs. May be nil.
+       Logger logrus.FieldLogger
+
        dd *DiscoveryDocument
 
        defaultRequestID string
@@ -248,8 +252,6 @@ var reqIDGen = httpserver.IDGenerator{Prefix: "req-"}
 
 var nopCancelFunc context.CancelFunc = func() {}
 
-var reqErrorRe = regexp.MustCompile(`net/http: invalid header `)
-
 // Do augments (*http.Client)Do(): adds Authorization and X-Request-Id
 // headers, delays in order to comply with rate-limiting restrictions,
 // and retries failed requests when appropriate.
@@ -307,14 +309,6 @@ func (c *Client) Do(req *http.Request) (*http.Response, error) {
                if c.Timeout == 0 {
                        return false, nil
                }
-               // This check can be removed when
-               // https://github.com/hashicorp/go-retryablehttp/pull/210
-               // (or equivalent) is merged and we update go.mod.
-               // Until then, it is needed to pass
-               // TestNonRetryableStdlibError.
-               if respErr != nil && reqErrorRe.MatchString(respErr.Error()) {
-                       return false, nil
-               }
                retrying, err := retryablehttp.DefaultRetryPolicy(ctx, resp, respErr)
                if retrying {
                        lastResp, lastRespBody, lastErr = resp, nil, respErr