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
This commit is contained in:
David Fifield 2018-03-12 20:28:01 -07:00 committed by Arlo Breault
parent 8a31312ca1
commit c61336c897

View file

@ -80,7 +80,8 @@ func (bc *BrokerChannel) Negotiate(offer *webrtc.SessionDescription) (
bc.Host, "\nFront URL: ", bc.url.Host) bc.Host, "\nFront URL: ", bc.url.Host)
data := bytes.NewReader([]byte(offer.Serialize())) data := bytes.NewReader([]byte(offer.Serialize()))
// Suffix with broker's client registration handler. // 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 { if nil != err {
return nil, err return nil, err
} }