summaryrefslogtreecommitdiff
path: root/src/node_url.cc
diff options
context:
space:
mode:
authorBradley Farias <bradley.meck@gmail.com>2017-07-31 17:02:23 -0500
committerBradley Farias <bradley.meck@gmail.com>2017-07-31 17:02:23 -0500
commit375d4a7385544d9a85de77e8fbbecebf0d5e6861 (patch)
treecf0d6e42296b8ae2cbcaccafc0f19f3c3f3b9ba3 /src/node_url.cc
parent48d3401f195a3127c6343f364d92ea038e135e48 (diff)
downloadnode-new-pull/14369/head.tar.gz
properly decode url encoding in pathnamespull/14369/head
Diffstat (limited to 'src/node_url.cc')
-rw-r--r--src/node_url.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/node_url.cc b/src/node_url.cc
index 75f262bad5..d961b9ede0 100644
--- a/src/node_url.cc
+++ b/src/node_url.cc
@@ -886,6 +886,17 @@ static url_host_type ParseHost(url_host* host,
return type;
}
+std::string node::url::URL::decoded_path() {
+ std::string ret;
+ for (auto i = context_.path.begin(); i != context_.path.end(); i++) {
+ ret += '/';
+ std::string tmp;
+ PercentDecode(i->c_str(), i->length(), &tmp);
+ ret += tmp;
+ }
+ return ret;
+}
+
// Locates the longest sequence of 0 segments in an IPv6 address
// in order to use the :: compression when serializing
static inline uint16_t* FindLongestZeroSequence(uint16_t* values,