Loading Gopkg.lock +2 −2 Original line number Diff line number Diff line Loading @@ -266,11 +266,11 @@ version = "v1.6.2" [[projects]] digest = "1:d8cdc0d262dd90e44b64e5345f3e5b3c1d5e18e64c58be40bc3573b6376cbe11" digest = "1:e2f2cd85250d569d2ba86b4e73a5b5571db190f8d86333931feb36f82495b18d" name = "github.com/gorilla/websocket" packages = ["."] pruneopts = "" revision = "5ed622c449da6d44c3c8329331ff47a9e5844f71" revision = "95ba29eb981bbb27d92e1f70bf8a1949452d926b" [[projects]] digest = "1:b563eec078077ba5cedc795462cbd6d7c75a106a4d2e3d02940093c80e28de28" Loading Gopkg.toml +1 −1 Original line number Diff line number Diff line Loading @@ -36,7 +36,7 @@ [[constraint]] name = "github.com/gorilla/websocket" revision = "5ed622c449da6d44c3c8329331ff47a9e5844f71" revision = "95ba29eb981bbb27d92e1f70bf8a1949452d926b" [[constraint]] name = "github.com/yuin/gopher-lua" Loading vendor/github.com/gorilla/websocket/.travis.yml +1 −3 Original line number Diff line number Diff line Loading @@ -3,13 +3,11 @@ sudo: false matrix: include: - go: 1.4 - go: 1.5.x - go: 1.6.x - go: 1.7.x - go: 1.8.x - go: 1.9.x - go: 1.10.x - go: 1.11.x - go: tip allow_failures: - go: tip Loading vendor/github.com/gorilla/websocket/README.md +1 −1 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ package API is stable. ### Protocol Compliance The Gorilla WebSocket package passes the server tests in the [Autobahn Test Suite](http://autobahn.ws/testsuite) using the application in the [examples/autobahn Suite](https://github.com/crossbario/autobahn-testsuite) using the application in the [examples/autobahn subdirectory](https://github.com/gorilla/websocket/tree/master/examples/autobahn). ### Gorilla WebSocket compared with other packages Loading vendor/github.com/gorilla/websocket/client.go +84 −19 Original line number Diff line number Diff line Loading @@ -6,12 +6,14 @@ package websocket import ( "bytes" "context" "crypto/tls" "errors" "io" "io/ioutil" "net" "net/http" "net/http/httptrace" "net/url" "strings" "time" Loading Loading @@ -51,6 +53,10 @@ type Dialer struct { // NetDial is nil, net.Dial is used. NetDial func(network, addr string) (net.Conn, error) // NetDialContext specifies the dial function for creating TCP connections. If // NetDialContext is nil, net.DialContext is used. NetDialContext func(ctx context.Context, network, addr string) (net.Conn, error) // Proxy specifies a function to return a proxy for a given // Request. If the function returns a non-nil error, the // request is aborted with the provided error. Loading @@ -64,11 +70,22 @@ type Dialer struct { // HandshakeTimeout specifies the duration for the handshake to complete. HandshakeTimeout time.Duration // ReadBufferSize and WriteBufferSize specify I/O buffer sizes. If a buffer // ReadBufferSize and WriteBufferSize specify I/O buffer sizes in bytes. If a buffer // size is zero, then a useful default size is used. The I/O buffer sizes // do not limit the size of the messages that can be sent or received. ReadBufferSize, WriteBufferSize int // WriteBufferPool is a pool of buffers for write operations. If the value // is not set, then write buffers are allocated to the connection for the // lifetime of the connection. // // A pool is most useful when the application has a modest volume of writes // across a large number of connections. // // Applications should use a single pool for each unique value of // WriteBufferSize. WriteBufferPool BufferPool // Subprotocols specifies the client's requested subprotocols. Subprotocols []string Loading @@ -84,6 +101,11 @@ type Dialer struct { Jar http.CookieJar } // Dial creates a new client connection by calling DialContext with a background context. func (d *Dialer) Dial(urlStr string, requestHeader http.Header) (*Conn, *http.Response, error) { return d.DialContext(context.Background(), urlStr, requestHeader) } var errMalformedURL = errors.New("malformed ws or wss URL") func hostPortNoPort(u *url.URL) (hostPort, hostNoPort string) { Loading Loading @@ -111,19 +133,20 @@ var DefaultDialer = &Dialer{ } // nilDialer is dialer to use when receiver is nil. var nilDialer Dialer = *DefaultDialer var nilDialer = *DefaultDialer // Dial creates a new client connection. Use requestHeader to specify the // DialContext creates a new client connection. Use requestHeader to specify the // origin (Origin), subprotocols (Sec-WebSocket-Protocol) and cookies (Cookie). // Use the response.Header to get the selected subprotocol // (Sec-WebSocket-Protocol) and cookies (Set-Cookie). // // The context will be used in the request and in the Dialer. // // If the WebSocket handshake fails, ErrBadHandshake is returned along with a // non-nil *http.Response so that callers can handle redirects, authentication, // etcetera. The response body may not contain the entire response and does not // need to be closed by the application. func (d *Dialer) Dial(urlStr string, requestHeader http.Header) (*Conn, *http.Response, error) { func (d *Dialer) DialContext(ctx context.Context, urlStr string, requestHeader http.Header) (*Conn, *http.Response, error) { if d == nil { d = &nilDialer } Loading Loading @@ -161,6 +184,7 @@ func (d *Dialer) Dial(urlStr string, requestHeader http.Header) (*Conn, *http.Re Header: make(http.Header), Host: u.Host, } req = req.WithContext(ctx) // Set the cookies present in the cookie jar of the dialer if d.Jar != nil { Loading Loading @@ -204,20 +228,30 @@ func (d *Dialer) Dial(urlStr string, requestHeader http.Header) (*Conn, *http.Re req.Header["Sec-WebSocket-Extensions"] = []string{"permessage-deflate; server_no_context_takeover; client_no_context_takeover"} } var deadline time.Time if d.HandshakeTimeout != 0 { deadline = time.Now().Add(d.HandshakeTimeout) var cancel func() ctx, cancel = context.WithTimeout(ctx, d.HandshakeTimeout) defer cancel() } // Get network dial function. netDial := d.NetDial if netDial == nil { netDialer := &net.Dialer{Deadline: deadline} netDial = netDialer.Dial var netDial func(network, add string) (net.Conn, error) if d.NetDialContext != nil { netDial = func(network, addr string) (net.Conn, error) { return d.NetDialContext(ctx, network, addr) } } else if d.NetDial != nil { netDial = d.NetDial } else { netDialer := &net.Dialer{} netDial = func(network, addr string) (net.Conn, error) { return netDialer.DialContext(ctx, network, addr) } } // If needed, wrap the dial function to set the connection deadline. if !deadline.Equal(time.Time{}) { if deadline, ok := ctx.Deadline(); ok { forwardDial := netDial netDial = func(network, addr string) (net.Conn, error) { c, err := forwardDial(network, addr) Loading Loading @@ -249,7 +283,17 @@ func (d *Dialer) Dial(urlStr string, requestHeader http.Header) (*Conn, *http.Re } hostPort, hostNoPort := hostPortNoPort(u) trace := httptrace.ContextClientTrace(ctx) if trace != nil && trace.GetConn != nil { trace.GetConn(hostPort) } netConn, err := netDial("tcp", hostPort) if trace != nil && trace.GotConn != nil { trace.GotConn(httptrace.GotConnInfo{ Conn: netConn, }) } if err != nil { return nil, nil, err } Loading @@ -267,22 +311,31 @@ func (d *Dialer) Dial(urlStr string, requestHeader http.Header) (*Conn, *http.Re } tlsConn := tls.Client(netConn, cfg) netConn = tlsConn if err := tlsConn.Handshake(); err != nil { return nil, nil, err var err error if trace != nil { err = doHandshakeWithTrace(trace, tlsConn, cfg) } else { err = doHandshake(tlsConn, cfg) } if !cfg.InsecureSkipVerify { if err := tlsConn.VerifyHostname(cfg.ServerName); err != nil { if err != nil { return nil, nil, err } } } conn := newConn(netConn, false, d.ReadBufferSize, d.WriteBufferSize) conn := newConn(netConn, false, d.ReadBufferSize, d.WriteBufferSize, d.WriteBufferPool, nil, nil) if err := req.Write(netConn); err != nil { return nil, nil, err } if trace != nil && trace.GotFirstResponseByte != nil { if peek, err := conn.br.Peek(1); err == nil && len(peek) == 1 { trace.GotFirstResponseByte() } } resp, err := http.ReadResponse(conn.br, req) if err != nil { return nil, nil, err Loading Loading @@ -328,3 +381,15 @@ func (d *Dialer) Dial(urlStr string, requestHeader http.Header) (*Conn, *http.Re netConn = nil // to avoid close in defer. return conn, resp, nil } func doHandshake(tlsConn *tls.Conn, cfg *tls.Config) error { if err := tlsConn.Handshake(); err != nil { return err } if !cfg.InsecureSkipVerify { if err := tlsConn.VerifyHostname(cfg.ServerName); err != nil { return err } } return nil } Loading
Gopkg.lock +2 −2 Original line number Diff line number Diff line Loading @@ -266,11 +266,11 @@ version = "v1.6.2" [[projects]] digest = "1:d8cdc0d262dd90e44b64e5345f3e5b3c1d5e18e64c58be40bc3573b6376cbe11" digest = "1:e2f2cd85250d569d2ba86b4e73a5b5571db190f8d86333931feb36f82495b18d" name = "github.com/gorilla/websocket" packages = ["."] pruneopts = "" revision = "5ed622c449da6d44c3c8329331ff47a9e5844f71" revision = "95ba29eb981bbb27d92e1f70bf8a1949452d926b" [[projects]] digest = "1:b563eec078077ba5cedc795462cbd6d7c75a106a4d2e3d02940093c80e28de28" Loading
Gopkg.toml +1 −1 Original line number Diff line number Diff line Loading @@ -36,7 +36,7 @@ [[constraint]] name = "github.com/gorilla/websocket" revision = "5ed622c449da6d44c3c8329331ff47a9e5844f71" revision = "95ba29eb981bbb27d92e1f70bf8a1949452d926b" [[constraint]] name = "github.com/yuin/gopher-lua" Loading
vendor/github.com/gorilla/websocket/.travis.yml +1 −3 Original line number Diff line number Diff line Loading @@ -3,13 +3,11 @@ sudo: false matrix: include: - go: 1.4 - go: 1.5.x - go: 1.6.x - go: 1.7.x - go: 1.8.x - go: 1.9.x - go: 1.10.x - go: 1.11.x - go: tip allow_failures: - go: tip Loading
vendor/github.com/gorilla/websocket/README.md +1 −1 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ package API is stable. ### Protocol Compliance The Gorilla WebSocket package passes the server tests in the [Autobahn Test Suite](http://autobahn.ws/testsuite) using the application in the [examples/autobahn Suite](https://github.com/crossbario/autobahn-testsuite) using the application in the [examples/autobahn subdirectory](https://github.com/gorilla/websocket/tree/master/examples/autobahn). ### Gorilla WebSocket compared with other packages Loading
vendor/github.com/gorilla/websocket/client.go +84 −19 Original line number Diff line number Diff line Loading @@ -6,12 +6,14 @@ package websocket import ( "bytes" "context" "crypto/tls" "errors" "io" "io/ioutil" "net" "net/http" "net/http/httptrace" "net/url" "strings" "time" Loading Loading @@ -51,6 +53,10 @@ type Dialer struct { // NetDial is nil, net.Dial is used. NetDial func(network, addr string) (net.Conn, error) // NetDialContext specifies the dial function for creating TCP connections. If // NetDialContext is nil, net.DialContext is used. NetDialContext func(ctx context.Context, network, addr string) (net.Conn, error) // Proxy specifies a function to return a proxy for a given // Request. If the function returns a non-nil error, the // request is aborted with the provided error. Loading @@ -64,11 +70,22 @@ type Dialer struct { // HandshakeTimeout specifies the duration for the handshake to complete. HandshakeTimeout time.Duration // ReadBufferSize and WriteBufferSize specify I/O buffer sizes. If a buffer // ReadBufferSize and WriteBufferSize specify I/O buffer sizes in bytes. If a buffer // size is zero, then a useful default size is used. The I/O buffer sizes // do not limit the size of the messages that can be sent or received. ReadBufferSize, WriteBufferSize int // WriteBufferPool is a pool of buffers for write operations. If the value // is not set, then write buffers are allocated to the connection for the // lifetime of the connection. // // A pool is most useful when the application has a modest volume of writes // across a large number of connections. // // Applications should use a single pool for each unique value of // WriteBufferSize. WriteBufferPool BufferPool // Subprotocols specifies the client's requested subprotocols. Subprotocols []string Loading @@ -84,6 +101,11 @@ type Dialer struct { Jar http.CookieJar } // Dial creates a new client connection by calling DialContext with a background context. func (d *Dialer) Dial(urlStr string, requestHeader http.Header) (*Conn, *http.Response, error) { return d.DialContext(context.Background(), urlStr, requestHeader) } var errMalformedURL = errors.New("malformed ws or wss URL") func hostPortNoPort(u *url.URL) (hostPort, hostNoPort string) { Loading Loading @@ -111,19 +133,20 @@ var DefaultDialer = &Dialer{ } // nilDialer is dialer to use when receiver is nil. var nilDialer Dialer = *DefaultDialer var nilDialer = *DefaultDialer // Dial creates a new client connection. Use requestHeader to specify the // DialContext creates a new client connection. Use requestHeader to specify the // origin (Origin), subprotocols (Sec-WebSocket-Protocol) and cookies (Cookie). // Use the response.Header to get the selected subprotocol // (Sec-WebSocket-Protocol) and cookies (Set-Cookie). // // The context will be used in the request and in the Dialer. // // If the WebSocket handshake fails, ErrBadHandshake is returned along with a // non-nil *http.Response so that callers can handle redirects, authentication, // etcetera. The response body may not contain the entire response and does not // need to be closed by the application. func (d *Dialer) Dial(urlStr string, requestHeader http.Header) (*Conn, *http.Response, error) { func (d *Dialer) DialContext(ctx context.Context, urlStr string, requestHeader http.Header) (*Conn, *http.Response, error) { if d == nil { d = &nilDialer } Loading Loading @@ -161,6 +184,7 @@ func (d *Dialer) Dial(urlStr string, requestHeader http.Header) (*Conn, *http.Re Header: make(http.Header), Host: u.Host, } req = req.WithContext(ctx) // Set the cookies present in the cookie jar of the dialer if d.Jar != nil { Loading Loading @@ -204,20 +228,30 @@ func (d *Dialer) Dial(urlStr string, requestHeader http.Header) (*Conn, *http.Re req.Header["Sec-WebSocket-Extensions"] = []string{"permessage-deflate; server_no_context_takeover; client_no_context_takeover"} } var deadline time.Time if d.HandshakeTimeout != 0 { deadline = time.Now().Add(d.HandshakeTimeout) var cancel func() ctx, cancel = context.WithTimeout(ctx, d.HandshakeTimeout) defer cancel() } // Get network dial function. netDial := d.NetDial if netDial == nil { netDialer := &net.Dialer{Deadline: deadline} netDial = netDialer.Dial var netDial func(network, add string) (net.Conn, error) if d.NetDialContext != nil { netDial = func(network, addr string) (net.Conn, error) { return d.NetDialContext(ctx, network, addr) } } else if d.NetDial != nil { netDial = d.NetDial } else { netDialer := &net.Dialer{} netDial = func(network, addr string) (net.Conn, error) { return netDialer.DialContext(ctx, network, addr) } } // If needed, wrap the dial function to set the connection deadline. if !deadline.Equal(time.Time{}) { if deadline, ok := ctx.Deadline(); ok { forwardDial := netDial netDial = func(network, addr string) (net.Conn, error) { c, err := forwardDial(network, addr) Loading Loading @@ -249,7 +283,17 @@ func (d *Dialer) Dial(urlStr string, requestHeader http.Header) (*Conn, *http.Re } hostPort, hostNoPort := hostPortNoPort(u) trace := httptrace.ContextClientTrace(ctx) if trace != nil && trace.GetConn != nil { trace.GetConn(hostPort) } netConn, err := netDial("tcp", hostPort) if trace != nil && trace.GotConn != nil { trace.GotConn(httptrace.GotConnInfo{ Conn: netConn, }) } if err != nil { return nil, nil, err } Loading @@ -267,22 +311,31 @@ func (d *Dialer) Dial(urlStr string, requestHeader http.Header) (*Conn, *http.Re } tlsConn := tls.Client(netConn, cfg) netConn = tlsConn if err := tlsConn.Handshake(); err != nil { return nil, nil, err var err error if trace != nil { err = doHandshakeWithTrace(trace, tlsConn, cfg) } else { err = doHandshake(tlsConn, cfg) } if !cfg.InsecureSkipVerify { if err := tlsConn.VerifyHostname(cfg.ServerName); err != nil { if err != nil { return nil, nil, err } } } conn := newConn(netConn, false, d.ReadBufferSize, d.WriteBufferSize) conn := newConn(netConn, false, d.ReadBufferSize, d.WriteBufferSize, d.WriteBufferPool, nil, nil) if err := req.Write(netConn); err != nil { return nil, nil, err } if trace != nil && trace.GotFirstResponseByte != nil { if peek, err := conn.br.Peek(1); err == nil && len(peek) == 1 { trace.GotFirstResponseByte() } } resp, err := http.ReadResponse(conn.br, req) if err != nil { return nil, nil, err Loading Loading @@ -328,3 +381,15 @@ func (d *Dialer) Dial(urlStr string, requestHeader http.Header) (*Conn, *http.Re netConn = nil // to avoid close in defer. return conn, resp, nil } func doHandshake(tlsConn *tls.Conn, cfg *tls.Config) error { if err := tlsConn.Handshake(); err != nil { return err } if !cfg.InsecureSkipVerify { if err := tlsConn.VerifyHostname(cfg.ServerName); err != nil { return err } } return nil }