i2pd/tests/test-http-url_decode.cpp

20 lines
425 B
C++
Raw Normal View History

2016-04-27 03:00:00 +03:00
#include <cassert>
2022-11-23 06:28:33 +03:00
#include "HTTP.h"
2016-04-27 03:00:00 +03:00
using namespace i2p::http;
2016-05-24 03:00:00 +03:00
int main() {
2016-04-27 03:00:00 +03:00
std::string in("/%D1%81%D1%82%D1%80%D0%B0%D0%BD%D0%B8%D1%86%D0%B0/");
std::string out = UrlDecode(in);
assert(strcmp(out.c_str(), "/страница/") == 0);
in = "/%00/";
out = UrlDecode(in, false);
assert(strcmp(out.c_str(), "/%00/") == 0);
out = UrlDecode(in, true);
assert(strcmp(out.c_str(), "/\0/") == 0);
return 0;
}