cue-labs / oci

Go modules related to OCI (Open Container Initiative) registries
Apache License 2.0
23 stars 4 forks source link

ociauth: implement `GetBody` TODO #27

Closed tianon closed 7 months ago

tianon commented 7 months ago

This is suggested by the godoc for Authorizer.DoRequest, but was not implemented in the ociauth-provided implementation.

This is especially useful for endpoints like PushManifest in ociclient which uses bytes.NewReader and is thus restartable (and Go's http.NewRequestWithContext sets GetBody automatically for us, in that case).

Without this, I was getting net/http: HTTP/1.x transport connection broken: http: ContentLength=6415 with Body length 0 when ociauth would retry my PUT request after collecting the necessary authentication token, and I've verified that this does fix it.

I'm happy to adjust, rebase, amend, force push, let someone else carry, explain, etc as desired. :bow:

myitcv commented 7 months ago

@tianon - thanks for the contribution (I'll let @rogpeppe review).

Thanks also for signing off your commit for DCO (we use the same setup here as in the main CUE project). As an FYI, I've updated the README to reference a CONTRIBUTING guide (again based on the CUE guide) for future contributions from folks who aren't aware.

rogpeppe commented 7 months ago

LGTM modulo a few formatting nits, and I think it could do with a test. I can take it from here though. Moved to https://review.gerrithub.io/c/cue-labs/oci/+/1177062.