#25472: snowflake-client's `-url` option is intolerant of a missing path
 Reporter:  dcf                    |          Owner:  (none)
     Type:  defect                 |         Status:  needs_review
 Priority:  Medium                 |      Milestone:
Component:  Obfuscation/Snowflake  |        Version:
 Severity:  Minor                  |     Resolution:
 Keywords:  easy                   |  Actual Points:
Parent ID:                         |         Points:
 Reviewer:                         |        Sponsor:

Comment (by dcf):

 Replying to [comment:2 arlolra]:
 > > If the patch looks good, I think we should change proxy-go to use
 ResolveReference as well, because it avoids having to repeatedly re-parse
 brokerURL, and allows the base URL to have a path, as in the example
 > and attached one for review with the follow up suggested.

 Your attached patch looks good.

 I'm looking at how the browser proxy code does it. It also uses string
 concatenation, though the broker object constructor ensures that the URL
 ends in a slash, so you can't get the problem this ticket is about.

   constructor: (@url) ->
     @clients = 0
     # Ensure url has the right protocol + trailing slash.
     @url = 'http://' + @url if 0 == @url.indexOf('localhost', 0)
     @url = 'https://' + @url if 0 != @url.indexOf('http', 0)
     @url += '/' if '/' != @url.substr -1
   _postRequest: (id, xhr, urlSuffix, payload) =>
       xhr.open 'POST', @url + urlSuffix
 For uniformity, we could use the [https://developer.mozilla.org/en-
 US/docs/Web/API/URL/URL URL] constructor, which allows resolving a URL
 against a base URL, like ResolveReference:
       xhr.open 'POST', new URL(urlSuffix, @url).href
 What do you think? I attached a patch. The URL API is marked
 "experimental"; maybe we don't want to deal with that?

Ticket URL: <https://trac.torproject.org/projects/tor/ticket/25472#comment:3>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
tor-bugs mailing list

Reply via email to