forked from mirror/websocket
Modify client to work with Chrome debug server.
The Chrome debug server does not use case insensitive comparison on the Connection header tokens as required by the HTTP RFC. Modify the client to send "Connection: Upgrade" as expected by Chrome. Because this matches the examples in the RFC, this change might improve interoperability with other servers.
This commit is contained in:
parent
5625e8a51f
commit
f273336ae2
|
@ -40,7 +40,9 @@ func NewClient(netConn net.Conn, u *url.URL, requestHeader http.Header, readBufS
|
||||||
p = append(p, u.RequestURI()...)
|
p = append(p, u.RequestURI()...)
|
||||||
p = append(p, " HTTP/1.1\r\nHost: "...)
|
p = append(p, " HTTP/1.1\r\nHost: "...)
|
||||||
p = append(p, u.Host...)
|
p = append(p, u.Host...)
|
||||||
p = append(p, "\r\nUpgrade: websocket\r\nConnection: upgrade\r\nSec-WebSocket-Version: 13\r\nSec-WebSocket-Key: "...)
|
// "Upgrade" is capitalized for servers that do not use case insensitive
|
||||||
|
// comparisons on header tokens.
|
||||||
|
p = append(p, "\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Version: 13\r\nSec-WebSocket-Key: "...)
|
||||||
p = append(p, challengeKey...)
|
p = append(p, challengeKey...)
|
||||||
p = append(p, "\r\n"...)
|
p = append(p, "\r\n"...)
|
||||||
for k, vs := range requestHeader {
|
for k, vs := range requestHeader {
|
||||||
|
|
Loading…
Reference in New Issue