mirror of
https://github.com/KingDuckZ/kamokan.git
synced 2024-12-27 21:35:41 +00:00
Unescape + to space correctly
This commit is contained in:
parent
33c52b88d5
commit
fa33944919
4 changed files with 14 additions and 2 deletions
|
@ -147,7 +147,7 @@ namespace tawashi {
|
|||
const auto urlencoded_values = split_env_vars(m_cgi_env[CGIVars::QUERY_STRING]);
|
||||
retval.reserve(urlencoded_values.size());
|
||||
for (auto& itm : urlencoded_values) {
|
||||
retval[m_curl.url_unescape(itm.first)] = m_curl.url_unescape(itm.second);
|
||||
retval[unescape_string(m_curl, itm.first)] = unescape_string(m_curl, itm.second);
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace tawashi {
|
|||
|
||||
CurlWrapper curl;
|
||||
for (auto& itm : split_env_vars(original_data)) {
|
||||
map[curl.url_unescape(itm.first)] = curl.url_unescape(itm.second);
|
||||
map[unescape_string(curl, itm.first)] = unescape_string(curl, itm.second);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include <curl/curl.h>
|
||||
#include <cassert>
|
||||
#include <ciso646>
|
||||
#include <algorithm>
|
||||
|
||||
#if !defined(NDEBUG)
|
||||
# define CURL_WRAPPER_VERBOSE
|
||||
|
@ -65,6 +66,15 @@ namespace tawashi {
|
|||
}
|
||||
} //unnamed namespace
|
||||
|
||||
std::string unescape_string (const CurlWrapper& parCurl, const boost::string_ref& parString) {
|
||||
if (parString.empty())
|
||||
return std::string();
|
||||
|
||||
std::string new_value(parString.data(), parString.size());
|
||||
std::replace(new_value.begin(), new_value.end(), '+', ' ');
|
||||
return parCurl.url_unescape(new_value);
|
||||
}
|
||||
|
||||
CurlWrapper::CurlWrapper() :
|
||||
m_curl(get_new_curl())
|
||||
{
|
||||
|
|
|
@ -21,4 +21,6 @@ namespace tawashi {
|
|||
private:
|
||||
CurlPtr m_curl;
|
||||
};
|
||||
|
||||
std::string unescape_string (const CurlWrapper& parCurl, const boost::string_ref& parString);
|
||||
} //namespace tawashi
|
||||
|
|
Loading…
Reference in a new issue