From 68d5ecf6bf9b05135f8dc8626752a28719a7c8d0 Mon Sep 17 00:00:00 2001 From: Derek McGowan Date: Mon, 11 May 2015 16:39:12 -0700 Subject: [PATCH] Update ReadFrom to wrap reader in NopCloser Wrapping the reader in a NopCloser is necessary to prevent the http library from closing the input reader. Signed-off-by: Derek McGowan (github: dmcgowan) --- registry/client/layer_upload.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/registry/client/layer_upload.go b/registry/client/layer_upload.go index 02cc5162..18e5fbab 100644 --- a/registry/client/layer_upload.go +++ b/registry/client/layer_upload.go @@ -5,6 +5,7 @@ import ( "errors" "fmt" "io" + "io/ioutil" "net/http" "os" "time" @@ -33,7 +34,7 @@ func (hlu *httpLayerUpload) handleErrorResponse(resp *http.Response) error { } func (hlu *httpLayerUpload) ReadFrom(r io.Reader) (n int64, err error) { - req, err := http.NewRequest("PATCH", hlu.location, r) + req, err := http.NewRequest("PATCH", hlu.location, ioutil.NopCloser(r)) if err != nil { return 0, err }