[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [websocket/master] Documentation updates.



commit a10c2e39d7b32973f95d18c29c8d26618782a64c
Author: David Fifield <david@xxxxxxxxxxxxxxx>
Date:   Fri Jun 28 07:13:33 2019 -0600

    Documentation updates.
    
    The requirement for HTTP/1.1 comes from RFC 6455. Using HTTP/1.0 was
    causing interoperability problems in https://bugs.torproject.org/30998.
---
 websocket/websocket.go | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/websocket/websocket.go b/websocket/websocket.go
index ea15218..af8abb1 100644
--- a/websocket/websocket.go
+++ b/websocket/websocket.go
@@ -332,7 +332,8 @@ func (handler *HTTPHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)
 	}
 	defer conn.Close()
 
-	// See RFC 6455 section 4.2.1 for this sequence of checks.
+	// See https://tools.ietf.org/html/rfc6455#section-4.2.1 for this
+	// sequence of checks.
 
 	// 1. An HTTP/1.1 or higher GET request, including a "Request-URI"...
 	if req.Method != "GET" {
@@ -392,9 +393,11 @@ func (handler *HTTPHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)
 	ws.MaxMessageSize = handler.Config.MaxMessageSize
 	ws.request = req
 
-	// See RFC 6455 section 4.2.2, item 5 for these steps.
+	// See https://tools.ietf.org/html/rfc6455#section-4.2.2 for these steps.
 
 	// 1. A Status-Line with a 101 response code as per RFC 2616.
+	// https://tools.ietf.org/html/rfc6455#section-11.1.1: "Use of WebSocket
+	// requires use of HTTP version 1.1 or higher."
 	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")

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits