URLdecode the base64 part of the key

This commit is contained in:
Francisco Blas (klondike) Izquierdo Riera 2015-02-07 18:34:25 +01:00
parent b22423e2d5
commit 1bbaa5ba22
3 changed files with 14 additions and 0 deletions

View file

@ -1,3 +1,4 @@
#include <cstdlib>
#include <string>
#include <algorithm>
#include <cctype>
@ -444,6 +445,16 @@ namespace http
query_.assign(query_i, url_s.end());
}
std::string urlDecode(const std::string& data)
{
std::string res(data);
for (size_t pos = res.find('%'); pos != std::string::npos; pos = res.find('%',pos+1))
{
char c = strtol(res.substr(pos+1,2).c_str(), NULL, 16);
res.replace(pos,3,1,c);
}
return res;
}
}
namespace net