diff --git a/src/http.js b/src/http.js index c3798122b7..ae6fb6979a 100644 --- a/src/http.js +++ b/src/http.js @@ -45,6 +45,10 @@ node.http.STATUS_CODES = { 100 : 'Continue' MIT License */ +function decode (s) { + return decodeURIComponent(s.replace(/\+/g, ' ')); +} + node.http.parseUri = function (str) { var o = node.http.parseUri.options, m = o.parser[o.strictMode ? "strict" : "loose"].exec(str), @@ -55,7 +59,11 @@ node.http.parseUri = function (str) { uri[o.q.name] = {}; uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) { - if ($1) uri[o.q.name][$1] = $2; + if ($1) { + var key = decode($1); + var val = decode($2); + uri[o.q.name][key] = val; + } }); uri.toString = function () { return str; }; @@ -80,7 +88,7 @@ node.http.parseUri.options = { , "anchor" ], q: { - name: "queryKey", + name: "params", parser: /(?:^|&)([^&=]*)=?([^&]*)/g }, parser: { diff --git a/website/api.html b/website/api.html index dc1a0cf690..3a8ec1192e 100644 --- a/website/api.html +++ b/website/api.html @@ -486,7 +486,7 @@ It is passed to the user as the first argument to the req.uri.user
req.uri.authority
req.uri.protocol -
req.uri.queryKey +
req.uri.params
req.uri.toString(), req.uri.source
The original URI found in the status line.