Only percent-encode non-printable ASCII chars(0x00-0x1f), non-ASCII

chars(>0x7f), ' ', '"', '<' and '>' for URIs supplied by user and
remote server(usually Location header field).
This commit is contained in:
Tatsuhiro Tsujikawa 2011-06-01 01:34:30 +09:00
parent 74a049ddfc
commit 2799c9f0cc
2 changed files with 16 additions and 22 deletions

View file

@ -102,13 +102,13 @@ void RequestTest::testSetUri17()
CPPUNIT_ASSERT(v);
CPPUNIT_ASSERT_EQUAL(std::string("http"), req.getProtocol());
CPPUNIT_ASSERT_EQUAL(std::string("host"), req.getHost());
CPPUNIT_ASSERT_EQUAL(std::string("/file%3Cwith%252%20%20space"),
CPPUNIT_ASSERT_EQUAL(std::string("/file%3Cwith%2%20%20space"),
req.getDir());
CPPUNIT_ASSERT_EQUAL(std::string("file%20with%20space;param%25"),
CPPUNIT_ASSERT_EQUAL(std::string("file%20with%20space;param%"),
req.getFile());
CPPUNIT_ASSERT_EQUAL(std::string("?a=/?"), req.getQuery());
CPPUNIT_ASSERT_EQUAL(std::string("http://host:80/file%3Cwith%252%20%20space"
"/file%20with%20space;param%25?a=/?"),
CPPUNIT_ASSERT_EQUAL(std::string("http://host:80/file%3Cwith%2%20%20space"
"/file%20with%20space;param%?a=/?"),
req.getCurrentUri());
CPPUNIT_ASSERT_EQUAL(std::string("http://host:80/file<with%2 %20space"
"/file with space;param%?a=/?"),