summaryrefslogtreecommitdiff
path: root/test/RequestTest.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2012-02-15 01:40:12 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2012-02-15 01:40:12 +0900
commitb7dbcea58bf0fea8792a653a64d8a87ae584d839 (patch)
tree2d63a3939f0bee56d3ee36c16b6b9b48c17193da /test/RequestTest.cc
parent9e302b86df6ed9ada7399c91fb33a8d955912d59 (diff)
Check scheme part in redirected URI more strictly.
The previous implementation mistakenly sees '/abspath?uri=http://foo' as an absolute URI because it contains '://', but actually it is not. This change checks scheme part is constructed in the allowed character set described in RFC 3986 Section 3.1.
Diffstat (limited to 'test/RequestTest.cc')
-rw-r--r--test/RequestTest.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/RequestTest.cc b/test/RequestTest.cc
index d21af8e7..651b4e52 100644
--- a/test/RequestTest.cc
+++ b/test/RequestTest.cc
@@ -142,6 +142,12 @@ void RequestTest::testRedirectUri()
CPPUNIT_ASSERT(req.redirectUri("//host/to/file"));
CPPUNIT_ASSERT_EQUAL(std::string("http://host/to/file"), req.getCurrentUri());
CPPUNIT_ASSERT_EQUAL(5, req.getRedirectCount());
+
+ // http:// in query part
+ CPPUNIT_ASSERT(req.redirectUri("/abspath?uri=http://foo"));
+ CPPUNIT_ASSERT_EQUAL(std::string("http://host/abspath?uri=http://foo"),
+ req.getCurrentUri());
+ CPPUNIT_ASSERT_EQUAL(6, req.getRedirectCount());
}
void RequestTest::testRedirectUri2()