Poco::URI::decode() doesn't properly handle '+'

GH #27: Poco::URI::decode() doesn't properly handle '+'
This commit is contained in:
aleks-f
2012-12-05 22:28:25 -06:00
parent 569ea46817
commit 7327be4735
4 changed files with 31 additions and 3 deletions

View File

@@ -767,6 +767,26 @@ void URITest::testOther()
}
void URITest::testEncodeDecode()
{
std::string str;
URI::encode("http://google.com/search?q=hello+world#frag ment", "+#?", str);
assert (str == "http://google.com/search%3Fq=hello%2Bworld%23frag%20ment");
str = "";
URI::encode("http://google.com/search?q=hello+world#frag ment", "", str);
assert (str == "http://google.com/search?q=hello+world#frag%20ment");
str = "";
URI::decode("http://google.com/search?q=hello+world#frag%20ment", str, true);
assert (str == "http://google.com/search?q=hello world#frag ment");
str = "";
URI::decode("http://google.com/search?q=hello%2Bworld#frag%20ment", str);
assert (str == "http://google.com/search?q=hello+world#frag ment");
}
void URITest::setUp()
{
}
@@ -788,6 +808,7 @@ CppUnit::Test* URITest::suite()
CppUnit_addTest(pSuite, URITest, testNormalize);
CppUnit_addTest(pSuite, URITest, testResolve);
CppUnit_addTest(pSuite, URITest, testSwap);
CppUnit_addTest(pSuite, URITest, testEncodeDecode);
CppUnit_addTest(pSuite, URITest, testOther);
return pSuite;