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

[tor-commits] [websocket/master] Added support for passing URLs



commit 0446621630483a656f179963ca77451f04aeaf01
Author: Hooman <hoomanm@xxxxxxxxxxxxx>
Date:   Thu Jul 20 15:31:27 2017 -0700

    Added support for passing URLs
---
 websocket/websocket.go | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/websocket/websocket.go b/websocket/websocket.go
index 7c649e3..b74e3ae 100644
--- a/websocket/websocket.go
+++ b/websocket/websocket.go
@@ -43,6 +43,7 @@ import (
 	"net"
 	"net/http"
 	"strings"
+	"net/url"
 )
 
 // Settings for potential WebSocket connections. Subprotocols is a list of
@@ -87,6 +88,9 @@ type WebSocket struct {
 	// Buffer for message payloads, which may be interrupted by control
 	// messages.
 	messageBuf bytes.Buffer
+	// Request URL
+	ReqURL url.URL
+
 }
 
 func applyMask(payload []byte, maskKey [4]byte) {
@@ -333,10 +337,14 @@ func (handler *HTTPHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)
 		httpError(w, bufrw, http.StatusMethodNotAllowed)
 		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",
@@ -387,6 +395,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
 
 	// 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