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

Re: [tor-bugs] #25472 [Obfuscation/Snowflake]: snowflake-client's `-url` option is intolerant of a missing path



#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
 above.
 >
 > 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.

 https://gitweb.torproject.org/pluggable-
 transports/snowflake.git/tree/proxy/broker.coffee?id=c61336c897b5d21cc94a21241e98b33df5dcbf78#n24
 {{{
   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
 }}}
 https://gitweb.torproject.org/pluggable-
 transports/snowflake.git/tree/proxy/broker.coffee?id=c61336c897b5d21cc94a21241e98b33df5dcbf78#n76
 {{{
   _postRequest: (id, xhr, urlSuffix, payload) =>
     try
       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
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs