diff options
| author | Bradley Farias <bradley.meck@gmail.com> | 2017-07-31 17:02:23 -0500 |
|---|---|---|
| committer | Bradley Farias <bradley.meck@gmail.com> | 2017-07-31 17:02:23 -0500 |
| commit | 375d4a7385544d9a85de77e8fbbecebf0d5e6861 (patch) | |
| tree | cf0d6e42296b8ae2cbcaccafc0f19f3c3f3b9ba3 /src/node_url.cc | |
| parent | 48d3401f195a3127c6343f364d92ea038e135e48 (diff) | |
| download | node-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.cc | 11 |
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, |
