Support "Sec-Websocket-Protocol" for old-style "Upgrade" calls.

This commit is contained in:
Joachim Bauch 2014-04-16 18:18:28 +02:00
parent 9474333b60
commit 2c95e6b09f
1 changed files with 5 additions and 0 deletions

View File

@ -144,6 +144,8 @@ func (u *Upgrader) Upgrade(w http.ResponseWriter, r *http.Request, responseHeade
break
}
}
} else if responseHeader != nil {
c.subprotocol = responseHeader.Get("Sec-Websocket-Protocol")
}
p := c.writeBuf[:0]
@ -156,6 +158,9 @@ func (u *Upgrader) Upgrade(w http.ResponseWriter, r *http.Request, responseHeade
p = append(p, "\r\n"...)
}
for k, vs := range responseHeader {
if k == "Sec-Websocket-Protocol" {
continue
}
for _, v := range vs {
p = append(p, k...)
p = append(p, ": "...)