From b7dbcea58bf0fea8792a653a64d8a87ae584d839 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Wed, 15 Feb 2012 01:40:12 +0900 Subject: 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. --- test/RequestTest.cc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test/RequestTest.cc') 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() -- cgit