[tor-commits] [snowflake/master] Use ResolveReference to construct the /client URL.

arlo at torproject.org arlo at torproject.org
Tue Mar 13 20:04:30 UTC 2018


commit c61336c897b5d21cc94a21241e98b33df5dcbf78
Author: David Fifield <david at bamsoftware.com>
Date:   Mon Mar 12 20:28:01 2018 -0700

    Use ResolveReference to construct the /client URL.
    
    This way works when the base URL lacks a path, e.g.
    "http://127.0.0.1:8080".
    https://bugs.torproject.org/25472
---
 client/rendezvous.go | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/client/rendezvous.go b/client/rendezvous.go
index 0aed3f7..cab7f5a 100644
--- a/client/rendezvous.go
+++ b/client/rendezvous.go
@@ -80,7 +80,8 @@ func (bc *BrokerChannel) Negotiate(offer *webrtc.SessionDescription) (
 		bc.Host, "\nFront URL:  ", bc.url.Host)
 	data := bytes.NewReader([]byte(offer.Serialize()))
 	// Suffix with broker's client registration handler.
-	request, err := http.NewRequest("POST", bc.url.String()+"client", data)
+	clientURL := bc.url.ResolveReference(&url.URL{Path: "client"})
+	request, err := http.NewRequest("POST", clientURL.String(), data)
 	if nil != err {
 		return nil, err
 	}



More information about the tor-commits mailing list