зеркало из https://github.com/microsoft/docker.git
move resumablerequestreader to pkg
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
This commit is contained in:
Родитель
487a417d9f
Коммит
c0517857f6
|
@ -0,0 +1 @@
|
|||
Cristian Staretu <cristian.staretu@gmail.com> (@unclejack)
|
|
@ -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
|
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче