distribution/registry/client
Aaron Lehmann 6beeb935cd Avoid stat round-trips when fetching a blob
Without this commit, three round-trips are required to fetch a blob with
a progress bar. The first is a call to Stat (HEAD request), to determine
the size. Then Open is called, which also calls Stat, and finally
performs a GET request.

Only the GET request is actually needed. The size of the blob can be
sniffed from Content-Length in the GET response.

This commit changes HTTPReadSeeker to automatically detect the size from
Content-Length instead of requiring it to be passed in. The Stat call is
removed from Open because it is no longer necessary.

HTTPReadSeeker now takes an additional errorHandler callback argument which
translates an unsuccessful HTTP response into an appropriate API-level
error. Using a callback for this makes it possible to avoid leaking the
repsonse body to Read's caller, which would make lifecycle management
problematic.

Fixes #1223

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-12-02 14:21:13 -08:00
..
auth Add expires_in and issued_at to the auth spec. 2015-10-27 11:05:33 -07:00
transport Avoid stat round-trips when fetching a blob 2015-12-02 14:21:13 -08:00
blob_writer_test.go Add ability to pass in substitution args into an Error 2015-07-15 11:02:10 -07:00
blob_writer.go Add pull through cache functionality to the Registry which can be configured 2015-08-04 16:09:55 -07:00
errors.go Move common error codes to errcode package 2015-08-11 11:50:58 -07:00
repository_test.go Correct unmarshal order for SignedManifest 2015-10-14 14:37:34 -07:00
repository.go Avoid stat round-trips when fetching a blob 2015-12-02 14:21:13 -08:00