Forráskód Böngészése

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.
Gary Burd 12 éve
szülő
commit
f273336ae2
1 módosított fájl, 3 hozzáadás és 1 törlés
  1. 3 1
      client.go

+ 3 - 1
client.go

@@ -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 {