Loading websocket/websocket.go +9 −0 Original line number Original line Diff line number Diff line Loading @@ -43,6 +43,7 @@ import ( "net" "net" "net/http" "net/http" "strings" "strings" "net/url" ) ) // Settings for potential WebSocket connections. Subprotocols is a list of // Settings for potential WebSocket connections. Subprotocols is a list of Loading Loading @@ -87,6 +88,9 @@ type WebSocket struct { // Buffer for message payloads, which may be interrupted by control // Buffer for message payloads, which may be interrupted by control // messages. // messages. messageBuf bytes.Buffer messageBuf bytes.Buffer // Request URL ReqURL url.URL } } func applyMask(payload []byte, maskKey [4]byte) { func applyMask(payload []byte, maskKey [4]byte) { Loading Loading @@ -333,10 +337,14 @@ func (handler *HTTPHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) httpError(w, bufrw, http.StatusMethodNotAllowed) httpError(w, bufrw, http.StatusMethodNotAllowed) return return } } /* URLs are accepted if req.URL.Path != "/" { if req.URL.Path != "/" { httpError(w, bufrw, http.StatusNotFound) httpError(w, bufrw, http.StatusNotFound) return return } } */ // 2. A |Host| header field containing the server's authority. // 2. A |Host| header field containing the server's authority. // We deliberately skip this test. // We deliberately skip this test. // 3. An |Upgrade| header field containing the value "websocket", // 3. An |Upgrade| header field containing the value "websocket", Loading Loading @@ -387,6 +395,7 @@ func (handler *HTTPHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) ws.Bufrw = bufrw ws.Bufrw = bufrw ws.IsClient = false ws.IsClient = false ws.MaxMessageSize = handler.Config.MaxMessageSize ws.MaxMessageSize = handler.Config.MaxMessageSize ws.ReqURL = *req.URL // See RFC 6455 section 4.2.2, item 5 for these steps. // See RFC 6455 section 4.2.2, item 5 for these steps. Loading Loading
websocket/websocket.go +9 −0 Original line number Original line Diff line number Diff line Loading @@ -43,6 +43,7 @@ import ( "net" "net" "net/http" "net/http" "strings" "strings" "net/url" ) ) // Settings for potential WebSocket connections. Subprotocols is a list of // Settings for potential WebSocket connections. Subprotocols is a list of Loading Loading @@ -87,6 +88,9 @@ type WebSocket struct { // Buffer for message payloads, which may be interrupted by control // Buffer for message payloads, which may be interrupted by control // messages. // messages. messageBuf bytes.Buffer messageBuf bytes.Buffer // Request URL ReqURL url.URL } } func applyMask(payload []byte, maskKey [4]byte) { func applyMask(payload []byte, maskKey [4]byte) { Loading Loading @@ -333,10 +337,14 @@ func (handler *HTTPHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) httpError(w, bufrw, http.StatusMethodNotAllowed) httpError(w, bufrw, http.StatusMethodNotAllowed) return return } } /* URLs are accepted if req.URL.Path != "/" { if req.URL.Path != "/" { httpError(w, bufrw, http.StatusNotFound) httpError(w, bufrw, http.StatusNotFound) return return } } */ // 2. A |Host| header field containing the server's authority. // 2. A |Host| header field containing the server's authority. // We deliberately skip this test. // We deliberately skip this test. // 3. An |Upgrade| header field containing the value "websocket", // 3. An |Upgrade| header field containing the value "websocket", Loading Loading @@ -387,6 +395,7 @@ func (handler *HTTPHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) ws.Bufrw = bufrw ws.Bufrw = bufrw ws.IsClient = false ws.IsClient = false ws.MaxMessageSize = handler.Config.MaxMessageSize ws.MaxMessageSize = handler.Config.MaxMessageSize ws.ReqURL = *req.URL // See RFC 6455 section 4.2.2, item 5 for these steps. // See RFC 6455 section 4.2.2, item 5 for these steps. Loading