You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// TODO some way for callers to specify that their "localhost" *does* require TLS (maybe only do this if `opts == nil`, but then users cannot supply *any* options and still get help setting Insecure for localhost 🤔 -- at least this is a more narrow use case than the opposite of not having a way to have non-localhost insecure registries)
47
53
}
48
54
49
-
ifclientOptions.Authorizer==nil {
50
-
// TODO https://github.com/cue-labs/oci/pull/28 -- ideally we'd set this sooner, but https://github.com/cue-labs/oci/blob/5ebe80b0a9a67ae83802d1fb1a189a8f0d089fb0/ociregistry/ociclient/client.go#L278-L282 means we have to do it late in case we installed a rate limiting HTTPClient (or the caller provided a custom one)
hostOptions:=clientOptions// make a copy, since "ociclient.New" mutates it (such that sharing the object afterwards probably isn't the best idea -- they'll have the same DebugID if so, which isn't ideal)
// "RoundTrip should not modify the request, except for consuming and closing the Request's Body."
37
+
ifreq.Body!=nil {
38
+
req.Body.Close()
39
+
}
40
+
req=req.Clone(ctx)
41
+
ifreq.GetBody!=nil {
42
+
varerrerror
43
+
req.Body, err=req.GetBody()
44
+
iferr!=nil {
45
+
returnnil, err
46
+
}
40
47
}
41
48
}
42
49
firstTry=false
43
50
44
-
res, err:=d.doer.Do(req)
51
+
// in theory, this RoundTripper we're invoking should close req.Body (per the RoundTripper contract), so we shouldn't have to 🤞
52
+
res, err:=d.roundTripper.RoundTrip(req)
45
53
iferr!=nil {
46
54
returnnil, err
47
55
}
48
56
49
57
// TODO 503 should probably result in at least one or two auto-retries (especially with the automatic retry delay this injects)
50
58
ifres.StatusCode==429 {
51
-
// satisfy the big scary warning on https://pkg.go.dev/net/http#Client.Do about the downsides of failing to Close the response body
59
+
// satisfy the big scary warnings on https://pkg.go.dev/net/http#RoundTripper and https://pkg.go.dev/net/http#Client.Do about the downsides of failing to Close the response body
0 commit comments