Skip to content

Commit

Permalink
Fix pullthrough serve blob
Browse files Browse the repository at this point in the history
Don't attempt to copy any data on a HEAD.

Signed-off-by: Michal Minar <miminar@redhat.com>
  • Loading branch information
Michal Minář committed Jul 12, 2016
1 parent d85642e commit d5a6fde
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions pkg/dockerregistry/server/pullthroughblobstore.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package server

import (
"io"
"net/http"
"strconv"
"time"

"github.com/docker/distribution"
"github.com/docker/distribution/context"
Expand Down Expand Up @@ -120,14 +120,12 @@ func (r *pullthroughBlobStore) ServeBlob(ctx context.Context, w http.ResponseWri
context.GetLogger(r.repo.ctx).Errorf("Failure to open remote store %q: %v", dgst.String(), err)
return err
}
defer remoteReader.Close()

setResponseHeaders(w, desc.Size, desc.MediaType, dgst)

context.GetLogger(r.repo.ctx).Infof("Copying %d bytes of type %q for %q", desc.Size, desc.MediaType, dgst.String())
if _, err := io.CopyN(w, remoteReader, desc.Size); err != nil {
context.GetLogger(r.repo.ctx).Errorf("Failed copying content from remote store %q: %v", dgst.String(), err)
return err
}
context.GetLogger(ctx).Infof("serving blob %s of type %s %d bytes long", dgst.String(), desc.MediaType, desc.Size)
http.ServeContent(w, req, desc.Digest.String(), time.Time{}, remoteReader)
return nil
}

Expand Down

0 comments on commit d5a6fde

Please sign in to comment.