|
@@ -4,12 +4,14 @@ import (
|
|
"fmt"
|
|
"fmt"
|
|
"runtime"
|
|
"runtime"
|
|
|
|
|
|
- "github.com/docker/docker/api/server/httputils"
|
|
|
|
"github.com/docker/docker/pkg/parsers/kernel"
|
|
"github.com/docker/docker/pkg/parsers/kernel"
|
|
"github.com/docker/docker/pkg/useragent"
|
|
"github.com/docker/docker/pkg/useragent"
|
|
"golang.org/x/net/context"
|
|
"golang.org/x/net/context"
|
|
)
|
|
)
|
|
|
|
|
|
|
|
+// UAStringKey is used as key type for user-agent string in net/context struct
|
|
|
|
+const UAStringKey = "upstream-user-agent"
|
|
|
|
+
|
|
// DockerUserAgent is the User-Agent the Docker client uses to identify itself.
|
|
// DockerUserAgent is the User-Agent the Docker client uses to identify itself.
|
|
// In accordance with RFC 7231 (5.5.3) is of the form:
|
|
// In accordance with RFC 7231 (5.5.3) is of the form:
|
|
// [docker client's UA] UpstreamClient([upstream client's UA])
|
|
// [docker client's UA] UpstreamClient([upstream client's UA])
|
|
@@ -37,9 +39,9 @@ func DockerUserAgent(ctx context.Context) string {
|
|
func getUserAgentFromContext(ctx context.Context) string {
|
|
func getUserAgentFromContext(ctx context.Context) string {
|
|
var upstreamUA string
|
|
var upstreamUA string
|
|
if ctx != nil {
|
|
if ctx != nil {
|
|
- var ki interface{} = ctx.Value(httputils.UAStringKey)
|
|
|
|
|
|
+ var ki interface{} = ctx.Value(UAStringKey)
|
|
if ki != nil {
|
|
if ki != nil {
|
|
- upstreamUA = ctx.Value(httputils.UAStringKey).(string)
|
|
|
|
|
|
+ upstreamUA = ctx.Value(UAStringKey).(string)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return upstreamUA
|
|
return upstreamUA
|