commit 083c570283b03972ca6b3485e55e732a7d91996d Author: Arlo Breault arlolra@gmail.com Date: Thu Jun 27 12:49:49 2019 -0400
Return HTTP/1.1 since it's required by the RFC
It appears at least Safari has introduced stricter validation around this. --- websocket/websocket.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/websocket/websocket.go b/websocket/websocket.go index 73b1ce7..ea15218 100644 --- a/websocket/websocket.go +++ b/websocket/websocket.go @@ -310,7 +310,7 @@ func sha1Hash(data string) []byte {
func httpError(w http.ResponseWriter, bufrw *bufio.ReadWriter, code int) { w.Header().Set("Connection", "close") - bufrw.WriteString(fmt.Sprintf("HTTP/1.0 %d %s\r\n", code, http.StatusText(code))) + bufrw.WriteString(fmt.Sprintf("HTTP/1.1 %d %s\r\n", code, http.StatusText(code))) w.Header().Write(bufrw) bufrw.WriteString("\r\n") bufrw.Flush() @@ -395,7 +395,7 @@ func (handler *HTTPHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) // See RFC 6455 section 4.2.2, item 5 for these steps.
// 1. A Status-Line with a 101 response code as per RFC 2616. - bufrw.WriteString(fmt.Sprintf("HTTP/1.0 %d %s\r\n", http.StatusSwitchingProtocols, http.StatusText(http.StatusSwitchingProtocols))) + bufrw.WriteString(fmt.Sprintf("HTTP/1.1 %d %s\r\n", http.StatusSwitchingProtocols, http.StatusText(http.StatusSwitchingProtocols))) // 2. An |Upgrade| header field with value "websocket" as per RFC 2616. w.Header().Set("Upgrade", "websocket") // 3. A |Connection| header field with value "Upgrade".
tor-commits@lists.torproject.org