summaryrefslogtreecommitdiff
path: root/registry/registry.go
diff options
context:
space:
mode:
authorTibor Vass <tiborvass@users.noreply.github.com>2016-01-25 22:45:06 -0800
committerTibor Vass <tiborvass@users.noreply.github.com>2016-01-25 22:45:06 -0800
commit07e2dedecb3a0b7381ebf0f8fb4d08d082754cd0 (patch)
tree25a442389f55046ad037f06b983d6e176281143c /registry/registry.go
parentc5380f9118e3fede06864346509743b511d91477 (diff)
parent61a49bb6ba2c0f17a31a64ee6336b4fc40c37f71 (diff)
downloaddocker-07e2dedecb3a0b7381ebf0f8fb4d08d082754cd0.tar.gz
Merge pull request #19057 from dnephin/remove_version_from_registry_pkg
Remove dockerversion from registry package
Diffstat (limited to 'registry/registry.go')
-rw-r--r--registry/registry.go32
1 files changed, 7 insertions, 25 deletions
diff --git a/registry/registry.go b/registry/registry.go
index bacc4aed1f..f135cc1b7b 100644
--- a/registry/registry.go
+++ b/registry/registry.go
@@ -21,9 +21,6 @@ import (
"github.com/docker/distribution/registry/api/v2"
"github.com/docker/distribution/registry/client"
"github.com/docker/distribution/registry/client/transport"
- "github.com/docker/docker/dockerversion"
- "github.com/docker/docker/pkg/parsers/kernel"
- "github.com/docker/docker/pkg/useragent"
"github.com/docker/go-connections/tlsconfig"
)
@@ -34,23 +31,7 @@ var (
errLoginRequired = errors.New("Authentication is required.")
)
-// dockerUserAgent is the User-Agent the Docker client uses to identify itself.
-// It is populated on init(), comprising version information of different components.
-var dockerUserAgent string
-
func init() {
- httpVersion := make([]useragent.VersionInfo, 0, 6)
- httpVersion = append(httpVersion, useragent.VersionInfo{Name: "docker", Version: dockerversion.Version})
- httpVersion = append(httpVersion, useragent.VersionInfo{Name: "go", Version: runtime.Version()})
- httpVersion = append(httpVersion, useragent.VersionInfo{Name: "git-commit", Version: dockerversion.GitCommit})
- if kernelVersion, err := kernel.GetKernelVersion(); err == nil {
- httpVersion = append(httpVersion, useragent.VersionInfo{Name: "kernel", Version: kernelVersion.String()})
- }
- httpVersion = append(httpVersion, useragent.VersionInfo{Name: "os", Version: runtime.GOOS})
- httpVersion = append(httpVersion, useragent.VersionInfo{Name: "arch", Version: runtime.GOARCH})
-
- dockerUserAgent = useragent.AppendVersions("", httpVersion...)
-
if runtime.GOOS != "linux" {
V2Only = true
}
@@ -130,12 +111,13 @@ func ReadCertsDirectory(tlsConfig *tls.Config, directory string) error {
return nil
}
-// DockerHeaders returns request modifiers that ensure requests have
-// the User-Agent header set to dockerUserAgent and that metaHeaders
-// are added.
-func DockerHeaders(metaHeaders http.Header) []transport.RequestModifier {
- modifiers := []transport.RequestModifier{
- transport.NewHeaderRequestModifier(http.Header{"User-Agent": []string{dockerUserAgent}}),
+// DockerHeaders returns request modifiers with a User-Agent and metaHeaders
+func DockerHeaders(userAgent string, metaHeaders http.Header) []transport.RequestModifier {
+ modifiers := []transport.RequestModifier{}
+ if userAgent != "" {
+ modifiers = append(modifiers, transport.NewHeaderRequestModifier(http.Header{
+ "User-Agent": []string{userAgent},
+ }))
}
if metaHeaders != nil {
modifiers = append(modifiers, transport.NewHeaderRequestModifier(metaHeaders))