factory generated from one place.

This commit is contained in:
Nan Monnand Deng 2013-08-02 04:10:26 -04:00
parent 4bd287e107
commit 5bc344ab73
1 changed files with 3 additions and 6 deletions

View File

@ -102,7 +102,7 @@ func (srv *Server) ContainerExport(name string, out io.Writer) error {
}
func (srv *Server) ImagesSearch(term string) ([]APISearch, error) {
r, err := registry.NewRegistry(srv.runtime.root, nil, srv.reqFactory)
r, err := registry.NewRegistry(srv.runtime.root, nil, srv.HTTPRequestFactory())
if err != nil {
return nil, err
}
@ -559,7 +559,7 @@ func (srv *Server) poolRemove(kind, key string) error {
}
func (srv *Server) ImagePull(localName string, tag string, out io.Writer, sf *utils.StreamFormatter, authConfig *auth.AuthConfig) error {
r, err := registry.NewRegistry(srv.runtime.root, authConfig, srv.reqFactory)
r, err := registry.NewRegistry(srv.runtime.root, authConfig, srv.HTTPRequestFactory())
if err != nil {
return err
}
@ -720,7 +720,7 @@ func (srv *Server) ImagePush(localName string, out io.Writer, sf *utils.StreamFo
out = utils.NewWriteFlusher(out)
img, err := srv.runtime.graph.Get(localName)
r, err2 := registry.NewRegistry(srv.runtime.root, authConfig, srv.reqFactory)
r, err2 := registry.NewRegistry(srv.runtime.root, authConfig, srv.HTTPRequestFactory())
if err2 != nil {
return err2
}
@ -1166,9 +1166,6 @@ func NewServer(flGraphPath string, autoRestart, enableCors bool, dns ListOpts) (
listeners: make(map[string]chan utils.JSONMessage),
reqFactory: nil,
}
ud := utils.NewHTTPUserAgentDecorator(srv.versionInfos()...)
factory := utils.NewHTTPRequestFactory(ud)
srv.reqFactory = factory
runtime.srv = srv
return srv, nil
}