[tor-commits] [flashproxy/master] Add get_query_param_string.

dcf at torproject.org dcf at torproject.org
Thu Sep 20 23:41:39 UTC 2012


commit f31cae79efa2042e344fcf30872a9fb2dc983787
Author: David Fifield <david at bamsoftware.com>
Date:   Thu Sep 20 16:06:20 2012 -0700

    Add get_query_param_string.
---
 flashproxy.js |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/flashproxy.js b/flashproxy.js
index cd31f60..51c2988 100644
--- a/flashproxy.js
+++ b/flashproxy.js
@@ -181,9 +181,20 @@ function build_url(scheme, host, port, path, params) {
     return parts.join("");
 }
 
-/* Get a query string parameter and parse it as an address spec. Returns
-   default_val if param is not defined in the query string. Returns null on a
-   parsing error. */
+/* Get a query string parameter and return it as a string. Returns default_val
+   if param is not defined in the query string. */
+function get_query_param_string(query, param, default_val) {
+    var val;
+
+    val = query[param];
+    if (val === undefined)
+        return default_val;
+    else
+        return val;
+}
+
+/* Get a query string parameter, or the given default, and parse it as an
+   address spec. Returns null on a parsing error. */
 function get_query_param_addr(query, param, default_val) {
     var val;
 





More information about the tor-commits mailing list