Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net/http: http2 transport doesn't send a default User-Agent #13685

Closed
bradfitz opened this issue Dec 18, 2015 · 6 comments

Comments

Projects
None yet
4 participants
@bradfitz
Copy link
Member

commented Dec 18, 2015

The Go http2 client doesn't send a default User-Agent header like the http1 client.

/cc @bmizerany

@bradfitz bradfitz self-assigned this Dec 18, 2015

@bradfitz bradfitz added this to the Go1.6 milestone Dec 18, 2015

@gopherbot

This comment has been minimized.

Copy link

commented Dec 19, 2015

CL https://golang.org/cl/18033 mentions this issue.

@rakyll

This comment has been minimized.

Copy link
Member

commented Dec 23, 2015

@bradfitz, could we append the default agent even if User-Agent is set? This allows us to see traffic metrics related to clients written in Go.

@minux

This comment has been minimized.

Copy link
Member

commented Dec 23, 2015

I don't like always appending the default user-agent.
If the user specifies the user agent, it must be for a
reason, and Go should respect that.

And note that we turned down one previous attempt
for sending the exact Go runtime.Version in the default
user agent for similar reasons.

@rakyll

This comment has been minimized.

Copy link
Member

commented Dec 23, 2015

I agree that client code must be able to override.

I'd be happy if we were allowing users to append to the default if they'd like to. But there are numerous ways to construct a Request instance (including the zero-value Request) and setting the default user agent during construction is not an option.

@bradfitz

This comment has been minimized.

Copy link
Member Author

commented Jan 6, 2016

@rakyll, let's move that planning into #13837

This bug is just about http2 feature and behavior parity with http1 for Go 1.6.

@gopherbot

This comment has been minimized.

Copy link

commented Jan 6, 2016

CL https://golang.org/cl/18284 mentions this issue.

bradfitz added a commit to golang/net that referenced this issue Jan 6, 2016

http2: set default User-Agent if not otherwise specified
Tests in main repo, named:

=== RUN   TestTransportUserAgent_h1
--- PASS: TestTransportUserAgent_h1 (0.00s)
=== RUN   TestTransportUserAgent_h2
--- PASS: TestTransportUserAgent_h2 (0.03s)

(in upcoming CL)

Updates golang/go#13685

Change-Id: I2b62489eb03b7ff791f1f6ae6dc9c4e4f6895d39
Reviewed-on: https://go-review.googlesource.com/18285
Reviewed-by: Ian Lance Taylor <iant@golang.org>

@bradfitz bradfitz closed this in 194a5c3 Jan 6, 2016

@golang golang locked and limited conversation to collaborators Jan 7, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.