x/net/websocket: override the Host header #33307
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?Relevant as of today's
master
ofx/net/websocket
(see below).Does this issue reproduce with the latest release?
Yes.
What did you do?
Tried changing the
Host
header appearing in the initial WebSocket query by creating a config throughwebsocket.NewConfig
and changing its host throughHeader.Set("Host", "example.com")
.What did you expect to see?
That the
Host
header would be set toexample.com
.What did you see instead?
That the
Host
header wasconfig.Location.Host
.In the current
master
, this is set on line 411 ofhybi.go
, inhybiClientHandshake
.Is this the intended API? It means that it becomes impossible to change the
Host
header without also changing theconfig.Location.Host
, which might be undesirable (in my use case because it has the undesired side effect of changing the TLS SNI field, which is also based onconfig.Location.Host
, and I can't have the SNI host and the WebSocket hosts be synchronized like that).Given that there's a field called
Header
, I would have expected that to impact what headers end up being set; I would have been less surprised ifhybiClientHandshake
had usedHeader.Get("Host")
if that header is set, and then fall back toconfig.Location.Host
if it's not (similar to what you would see with e.g. curl).The text was updated successfully, but these errors were encountered: