move resumablerequestreader to pkg

Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
This commit is contained in:
unclejack 2014-07-28 18:01:21 +03:00
parent 487a417d9f
commit c0517857f6
3 changed files with 6 additions and 3 deletions

View file

@ -0,0 +1 @@
Cristian Staretu <cristian.staretu@gmail.com> (@unclejack)

View file

@ -1,8 +1,9 @@
package utils
package httputils
import (
"fmt"
"io"
"log"
"net/http"
"time"
)
@ -70,7 +71,7 @@ func (r *resumableRequestReader) Read(p []byte) (n int, err error) {
r.cleanUpResponse()
}
if err != nil && err != io.EOF {
Debugf("encountered error during pull and clearing it before resume: %s", err)
log.Printf("encountered error during pull and clearing it before resume: %s", err)
err = nil
}
return n, err

View file

@ -24,6 +24,7 @@ import (
"time"
"github.com/docker/docker/dockerversion"
"github.com/docker/docker/pkg/httputils"
"github.com/docker/docker/utils"
)
@ -423,7 +424,7 @@ func (r *Registry) GetRemoteImageLayer(imgID, registry string, token []string, i
if res.Header.Get("Accept-Ranges") == "bytes" && imgSize > 0 {
utils.Debugf("server supports resume")
return utils.ResumableRequestReaderWithInitialResponse(client, req, 5, imgSize, res), nil
return httputils.ResumableRequestReaderWithInitialResponse(client, req, 5, imgSize, res), nil
}
utils.Debugf("server doesn't support resume")
return res.Body, nil