Update link to RFC9110 (obsoletes RFC7231), and outline the convention
used.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -13,10 +13,17 @@ import ( |
| 13 | 13 |
// UAStringKey is used as key type for user-agent string in net/context struct |
| 14 | 14 |
type UAStringKey struct{}
|
| 15 | 15 |
|
| 16 |
-// DockerUserAgent is the User-Agent the Docker client uses to identify itself. |
|
| 17 |
-// In accordance with RFC 7231 (5.5.3) is of the form: |
|
| 16 |
+// DockerUserAgent is the User-Agent used by the daemon. |
|
| 18 | 17 |
// |
| 19 |
-// [docker client's UA] UpstreamClient([upstream client's UA]) |
|
| 18 |
+// It consists of the daemon's User-Agent, optional version metadata, and |
|
| 19 |
+// an optional upstream client comment: |
|
| 20 |
+// |
|
| 21 |
+// [daemon user agent] [extra] [UpstreamClient(<upstream-user-agent>)] |
|
| 22 |
+// |
|
| 23 |
+// "UpstreamClient" is a Docker-defined convention. The upstream value is |
|
| 24 |
+// sanitized before inclusion. See [RFC9110], section 10.1.5. |
|
| 25 |
+// |
|
| 26 |
+// [RFC9110]: https://www.rfc-editor.org/rfc/rfc9110#section-10.1.5 |
|
| 20 | 27 |
func DockerUserAgent(ctx context.Context, extraVersions ...useragent.VersionInfo) string {
|
| 21 | 28 |
ua := useragent.AppendVersions(getDaemonUserAgent(), extraVersions...) |
| 22 | 29 |
if upstreamUA := getUpstreamUserAgent(ctx); upstreamUA != "" {
|