Update transport package to sever distribution dependency

The transport package no longer requires importing distribution for the ReadSeekCloser, instead declares its own.
Added comments on the Authenication handler in session.
Added todo on http seek reader to highlight its lack of belonging to the client transport.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
This commit is contained in:
Derek McGowan 2015-05-20 10:09:37 -07:00
parent 3b5a2bbebc
commit 7e4d5eafae
2 changed files with 13 additions and 3 deletions

View file

@ -9,14 +9,19 @@ import (
"io/ioutil"
"net/http"
"os"
"github.com/docker/distribution"
)
// ReadSeekCloser combines io.ReadSeeker with io.Closer.
type ReadSeekCloser interface {
io.ReadSeeker
io.Closer
}
// NewHTTPReadSeeker handles reading from an HTTP endpoint using a GET
// request. When seeking and starting a read from a non-zero offset
// the a "Range" header will be added which sets the offset.
func NewHTTPReadSeeker(client *http.Client, url string, size int64) distribution.ReadSeekCloser {
// TODO(dmcgowan): Move this into a separate utility package
func NewHTTPReadSeeker(client *http.Client, url string, size int64) ReadSeekCloser {
return &httpReadSeeker{
client: client,
url: url,