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:
Gary Burd 2013-12-21 08:28:48 -08:00
parent 5625e8a51f
commit f273336ae2
1 changed files with 3 additions and 1 deletions

View File

@ -40,7 +40,9 @@ func NewClient(netConn net.Conn, u *url.URL, requestHeader http.Header, readBufS
p = append(p, u.RequestURI()...)
p = append(p, " HTTP/1.1\r\nHost: "...)
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, "\r\n"...)
for k, vs := range requestHeader {