From f273336ae266a6f590f814fe5361c5757b83b5c1 Mon Sep 17 00:00:00 2001 From: Gary Burd Date: Sat, 21 Dec 2013 08:28:48 -0800 Subject: [PATCH] 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. --- client.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client.go b/client.go index a4090e1..759be22 100644 --- a/client.go +++ b/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 {