[tor-bugs] #7110 [Flashproxy]: Do real parsing of boolean query string parameters

Tor Bug Tracker & Wiki torproject-admin at torproject.org
Wed Oct 17 03:29:59 UTC 2012


#7110: Do real parsing of boolean query string parameters
------------------------+---------------------------------------------------
 Reporter:  dcf         |          Owner:  dcf
     Type:  defect      |         Status:  new
 Priority:  minor       |      Milestone:     
Component:  Flashproxy  |        Version:     
 Keywords:              |         Parent:     
   Points:              |   Actualpoints:     
------------------------+---------------------------------------------------

Comment(by dcf):

 Thanks, this looks better. A few more changes before I accept it:

 Use four-space indents, not hard tabs.

 Get rid of trailing whitespace. `git apply` complains:
 {{{
 $ git apply 0001-Patch-for-ticket-7110-adding-
 get_query_param_boolean.patch
 0001-Patch-for-ticket-7110-adding-get_query_param_boolean.patch:28: space
 before tab in indent.
                  expected: true},
 0001-Patch-for-ticket-7110-adding-get_query_param_boolean.patch:36:
 trailing whitespace.
                  expected: null},
 0001-Patch-for-ticket-7110-adding-get_query_param_boolean.patch:39:
 trailing whitespace.
         ];
 0001-Patch-for-ticket-7110-adding-get_query_param_boolean.patch:92:
 trailing whitespace.
         val = query[param]
 0001-Patch-for-ticket-7110-adding-get_query_param_boolean.patch:93:
 trailing whitespace.
         if (val === undefined) {
 warning: squelched 1 whitespace error
 warning: 6 lines add whitespace errors.
 }}}

 I think `get_query_param_boolean` can be written more clearly:
 {{{
     if (val === undefined)
         return default_val;
     else if (val === "true" || val === "1" || val === "")
         return true;
     else if (val === "false" || val === "0")
         return false;
     else
         return null;
 }}}

 The comment above `get_query_param_boolean` should state exactly which
 values are considered true, which are considered false, and that all other
 values return `null`.

 The documentation for the `debug` parameter at the top of the file should
 say what values are true, because "(to any value)" is not the case
 anymore.

-- 
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/7110#comment:2>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list