Merge pull request #1243 from RichardScothern/client-header-message

Add clearer messaging around missing content-length headers.
This commit is contained in:
Richard Scothern 2015-12-08 09:54:18 -08:00
commit e7e0b72ae0
2 changed files with 57 additions and 0 deletions

View file

@ -488,6 +488,10 @@ func (bs *blobStatter) Stat(ctx context.Context, dgst digest.Digest) (distributi
if SuccessStatus(resp.StatusCode) {
lengthHeader := resp.Header.Get("Content-Length")
if lengthHeader == "" {
return distribution.Descriptor{}, fmt.Errorf("missing content-length header for request: %s", u)
}
length, err := strconv.ParseInt(lengthHeader, 10, 64)
if err != nil {
return distribution.Descriptor{}, fmt.Errorf("error parsing content-length: %v", err)