diff --git a/acme/http.go b/acme/http.go index 8a8bf6db..8343b369 100644 --- a/acme/http.go +++ b/acme/http.go @@ -42,12 +42,14 @@ var ( ) const ( - // defaultGoUserAgent is the Go HTTP package user agent string. Too - // bad it isn't exported. If it changes, we should update it here, too. - defaultGoUserAgent = "Go-http-client/1.1" - // ourUserAgent is the User-Agent of this underlying library package. - ourUserAgent = "xenolf-acme" + // NOTE: Update this with each tagged release. + ourUserAgent = "xenolf-acme/1.2.1" + + // ourUserAgentComment is part of the UA comment linked to the version status of this underlying library package. + // values: detach|release + // NOTE: Update this with each tagged release. + ourUserAgentComment = "detach" // caCertificatesEnvVar is the environment variable name that can be used to // specify the path to PEM encoded CA Certificates that can be used to @@ -205,6 +207,6 @@ func post(j *jws, uri string, reqBody []byte, respBody interface{}) (*http.Respo // userAgent builds and returns the User-Agent string to use in requests. func userAgent() string { - ua := fmt.Sprintf("%s %s (%s; %s) %s", UserAgent, ourUserAgent, runtime.GOOS, runtime.GOARCH, defaultGoUserAgent) + ua := fmt.Sprintf("%s %s (%s; %s; %s)", UserAgent, ourUserAgent, ourUserAgentComment, runtime.GOOS, runtime.GOARCH) return strings.TrimSpace(ua) } diff --git a/acme/http_test.go b/acme/http_test.go index 2c5654be..db1ca265 100644 --- a/acme/http_test.go +++ b/acme/http_test.go @@ -55,7 +55,6 @@ func TestHTTPUserAgent(t *testing.T) { func TestUserAgent(t *testing.T) { ua := userAgent() - assert.Contains(t, ua, defaultGoUserAgent) assert.Contains(t, ua, ourUserAgent) if strings.HasSuffix(ua, " ") { t.Errorf("UA should not have trailing spaces; got '%s'", ua) @@ -65,7 +64,6 @@ func TestUserAgent(t *testing.T) { UserAgent = "MyApp/1.2.3" ua = userAgent() - assert.Contains(t, ua, defaultGoUserAgent) assert.Contains(t, ua, ourUserAgent) assert.Contains(t, ua, UserAgent) }