|
@@ -103,7 +103,7 @@ func (u *Upgrader) selectSubprotocol(r *http.Request, responseHeader http.Header
|
|
|
//
|
|
//
|
|
|
// The responseHeader is included in the response to the client's upgrade
|
|
// The responseHeader is included in the response to the client's upgrade
|
|
|
// request. Use the responseHeader to specify cookies (Set-Cookie) and the
|
|
// request. Use the responseHeader to specify cookies (Set-Cookie) and the
|
|
|
-// application negotiated subprotocol (Sec-Websocket-Protocol).
|
|
|
|
|
|
|
+// application negotiated subprotocol (Sec-WebSocket-Protocol).
|
|
|
//
|
|
//
|
|
|
// If the upgrade fails, then Upgrade replies to the client with an HTTP error
|
|
// If the upgrade fails, then Upgrade replies to the client with an HTTP error
|
|
|
// response.
|
|
// response.
|
|
@@ -127,7 +127,7 @@ func (u *Upgrader) Upgrade(w http.ResponseWriter, r *http.Request, responseHeade
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if _, ok := responseHeader["Sec-Websocket-Extensions"]; ok {
|
|
if _, ok := responseHeader["Sec-Websocket-Extensions"]; ok {
|
|
|
- return u.returnError(w, r, http.StatusInternalServerError, "websocket: application specific 'Sec-Websocket-Extensions' headers are unsupported")
|
|
|
|
|
|
|
+ return u.returnError(w, r, http.StatusInternalServerError, "websocket: application specific 'Sec-WebSocket-Extensions' headers are unsupported")
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
checkOrigin := u.CheckOrigin
|
|
checkOrigin := u.CheckOrigin
|
|
@@ -140,7 +140,7 @@ func (u *Upgrader) Upgrade(w http.ResponseWriter, r *http.Request, responseHeade
|
|
|
|
|
|
|
|
challengeKey := r.Header.Get("Sec-Websocket-Key")
|
|
challengeKey := r.Header.Get("Sec-Websocket-Key")
|
|
|
if challengeKey == "" {
|
|
if challengeKey == "" {
|
|
|
- return u.returnError(w, r, http.StatusBadRequest, "websocket: not a websocket handshake: `Sec-Websocket-Key' header is missing or blank")
|
|
|
|
|
|
|
+ return u.returnError(w, r, http.StatusBadRequest, "websocket: not a websocket handshake: `Sec-WebSocket-Key' header is missing or blank")
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
subprotocol := u.selectSubprotocol(r, responseHeader)
|
|
subprotocol := u.selectSubprotocol(r, responseHeader)
|
|
@@ -190,12 +190,12 @@ func (u *Upgrader) Upgrade(w http.ResponseWriter, r *http.Request, responseHeade
|
|
|
p = append(p, computeAcceptKey(challengeKey)...)
|
|
p = append(p, computeAcceptKey(challengeKey)...)
|
|
|
p = append(p, "\r\n"...)
|
|
p = append(p, "\r\n"...)
|
|
|
if c.subprotocol != "" {
|
|
if c.subprotocol != "" {
|
|
|
- p = append(p, "Sec-Websocket-Protocol: "...)
|
|
|
|
|
|
|
+ p = append(p, "Sec-WebSocket-Protocol: "...)
|
|
|
p = append(p, c.subprotocol...)
|
|
p = append(p, c.subprotocol...)
|
|
|
p = append(p, "\r\n"...)
|
|
p = append(p, "\r\n"...)
|
|
|
}
|
|
}
|
|
|
if compress {
|
|
if compress {
|
|
|
- p = append(p, "Sec-Websocket-Extensions: permessage-deflate; server_no_context_takeover; client_no_context_takeover\r\n"...)
|
|
|
|
|
|
|
+ p = append(p, "Sec-WebSocket-Extensions: permessage-deflate; server_no_context_takeover; client_no_context_takeover\r\n"...)
|
|
|
}
|
|
}
|
|
|
for k, vs := range responseHeader {
|
|
for k, vs := range responseHeader {
|
|
|
if k == "Sec-Websocket-Protocol" {
|
|
if k == "Sec-Websocket-Protocol" {
|