FAQ
For an http request I am able to create a request that targets a url like
http://0.0.0.0 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:
  https://github.com/pweil-/net/compare/golang:master...master

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.

Thoughts?

Paul

--
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

  • Mikio Hara at Feb 20, 2015 at 1:16 am
    how about adding a few new control knobs for controlling underlying
    transport connections, to accommodate not only inet/inet6 domain but
    local/unix domain stuff, instead?

    e.g.,
    type Dialer struct {
             Config
             Transport *http.Transport
    }
    func (d *Dialer) Dial() (net.Conn, error) { ... }

    then

    d := websocket.Dialer{
             Transport: &http.Transport{
                    Dial: func(network, address string) (net.Conn, error) {
                           return net.Dial("unix", "/path/to/somewhere")
                    },
              },
    }
    c, err := d.Dial()

    On Tue, Feb 17, 2015 at 5:50 AM, wrote:
    For an http request I am able to create a request that targets a url like
    http://0.0.0.0 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:
    https://github.com/pweil-/net/compare/golang:master...master

    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.

    Thoughts?

    Paul

    --
    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.
    --
    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.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedFeb 17, '15 at 2:31a
activeFeb 20, '15 at 1:16a
posts2
users2
websitegolang.org

2 users in discussion

Pweil: 1 post Mikio Hara: 1 post

People

Translate

site design / logo © 2022 Grokbase