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

[tor-commits] [websocket/master] Expose the entire ws request instead of just the URL



commit 02a8eb6d7a236f8b805dbd086f1c46f5dfb51149
Author: Hooman <hoomanm@xxxxxxxxxxxxx>
Date:   Fri Jul 28 17:29:04 2017 -0700

    Expose the entire ws request instead of just the URL
---
 websocket/websocket.go | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/websocket/websocket.go b/websocket/websocket.go
index b74e3ae..fac649b 100644
--- a/websocket/websocket.go
+++ b/websocket/websocket.go
@@ -43,7 +43,6 @@ import (
 	"net"
 	"net/http"
 	"strings"
-	"net/url"
 )
 
 // Settings for potential WebSocket connections. Subprotocols is a list of
@@ -88,9 +87,12 @@ type WebSocket struct {
 	// Buffer for message payloads, which may be interrupted by control
 	// messages.
 	messageBuf bytes.Buffer
-	// Request URL
-	ReqURL url.URL
+	// Request
+	request http.Request
+}
 
+func (ws *WebSocket) Request() http.Request {
+	return ws.request
 }
 
 func applyMask(payload []byte, maskKey [4]byte) {
@@ -338,13 +340,6 @@ func (handler *HTTPHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)
 		return
 	}
 
-	/* URLs are accepted
-	if req.URL.Path != "/" {
-		httpError(w, bufrw, http.StatusNotFound)
-		return
-	}
-	*/
-
 	// 2. A |Host| header field containing the server's authority.
 	// We deliberately skip this test.
 	// 3. An |Upgrade| header field containing the value "websocket",
@@ -395,7 +390,7 @@ func (handler *HTTPHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)
 	ws.Bufrw = bufrw
 	ws.IsClient = false
 	ws.MaxMessageSize = handler.Config.MaxMessageSize
-	ws.ReqURL =  *req.URL
+	ws.request = *req
 
 	// See RFC 6455 section 4.2.2, item 5 for these steps.
 



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