mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-27 11:17:49 +02:00
URLdecode the base64 part of the key
This commit is contained in:
parent
b22423e2d5
commit
1bbaa5ba22
3 changed files with 14 additions and 0 deletions
11
util.cpp
11
util.cpp
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue