For an http request I am able to create a request that targets a url like and set the Host on the http.Request to whatever I want.
  This is handy for testing infrastructure that does routing or serving
based on the host header.

For web socket requests it looks like the config.Location.Host that is used
in the dial is also always used in the handshake. Since the web socket
client has access to the http headers I'd like to be able to set the Host
header and have it reflected in the handshake, taking priority over the
config.Location.Host. Like this:

A small nit on my code snippet, this would deviate from the way a
http.Request sets the Host. It is a documented item that http.Request uses
an explicit Host field rather than what is set in the header. Perhaps, if
this is a good feature for web sockets, the explicit field pattern should
be followed.



You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 2 | next ›
Discussion Overview
groupgolang-nuts @
postedFeb 17, '15 at 2:31a
activeFeb 20, '15 at 1:16a

2 users in discussion

Pweil: 1 post Mikio Hara: 1 post



site design / logo © 2022 Grokbase