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: figure out a better User-Agent story #13837

Closed
bradfitz opened this issue Jan 6, 2016 · 6 comments
Closed

net/http: figure out a better User-Agent story #13837

bradfitz opened this issue Jan 6, 2016 · 6 comments
Labels
FeatureRequest FrozenDueToAge help wanted NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone

Comments

@bradfitz
Copy link
Contributor

bradfitz commented Jan 6, 2016

Fork of some discussion in #13685

Let's figure out User-Agents in Go 1.7: perhaps an optional func field on http1 and http2 Transports to modify the User-Agent before it's sent out?

   SetUserAgent  func(old string) string

Or fields for the default value to set if unset? Or a field to append? Maybe those are the two common requests.

In any case, the stdlib's private http2 Transport should use the public http1.Transport's same options, and this should all have new clientserver_test.go additions similar to https://go-review.googlesource.com/18284

/cc @okdave @rakyll @adg

@rakyll
Copy link
Contributor

rakyll commented Feb 13, 2016

I don't know why we may like to handle it in the Transport layer. Can we have a setter and an appender on *Request?

package http

func (r *Request) AppendUserAgent(ua string) 
func (r *Request) SetUserAgent(ua string)

AppendUserAgent appends to the old user agent. If old user agent is empty, it appends to the default UA.
SetUserAgent sets the user agent to the given value.

@okdave
Copy link
Contributor

okdave commented Feb 15, 2016

To be honest, I don't see the big downside in the status quo. What problem are we trying to solve?

@bradfitz bradfitz modified the milestones: Go1.8Maybe, Go1.7 May 4, 2016
@bradfitz
Copy link
Contributor Author

bradfitz commented May 4, 2016

Too late for Go 1.7 anyway.

@quentinmit quentinmit added the NeedsFix The path to resolution is known, but the work has not been done. label Oct 10, 2016
@rsc rsc modified the milestones: Go1.9, Go1.8Maybe Oct 20, 2016
@bradfitz bradfitz modified the milestones: Go1.10, Go1.9 May 24, 2017
@bradfitz
Copy link
Contributor Author

The problem here is there are too many RoundTripper wrapper implementations which just set or append User-Agents.

Somebody should do an audit (including those inside gocloud) here in this bug before anything happens, though. Maybe it's not as bad as I remember.

@bradfitz bradfitz removed their assignment May 24, 2017
@bradfitz bradfitz added help wanted NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. and removed NeedsFix The path to resolution is known, but the work has not been done. labels May 24, 2017
@rsc rsc modified the milestones: Go1.10, Go1.11 Nov 22, 2017
@gopherbot gopherbot modified the milestones: Go1.11, Unplanned May 23, 2018
@rsc
Copy link
Contributor

rsc commented Jun 11, 2018

@bradfitz roll into 'new HTTP client API' issue?

@bradfitz bradfitz self-assigned this Oct 6, 2020
@bradfitz
Copy link
Contributor Author

bradfitz commented Oct 6, 2020

Closing, folding into #23707.

@bradfitz bradfitz closed this as completed Oct 6, 2020
@golang golang locked and limited conversation to collaborators Oct 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FeatureRequest FrozenDueToAge help wanted NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Projects
None yet
Development

No branches or pull requests

6 participants