diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2011-11-05 13:16:45 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2011-11-05 13:16:45 +0900 |
| commit | 5e2a8b2d4cd861c66363707191b8fa88114f623a (patch) | |
| tree | 1b39105320de201b8e427154e2a4b0f60323ddd8 /test/RequestTest.cc | |
| parent | 0b515d720412669fd2157ba7c3344a6c7199cd5e (diff) | |
Fixed bug that some information such as port number is lost if
redirect URI contains only path component.
Diffstat (limited to 'test/RequestTest.cc')
| -rw-r--r-- | test/RequestTest.cc | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/test/RequestTest.cc b/test/RequestTest.cc index 33c213d3..9cb7b446 100644 --- a/test/RequestTest.cc +++ b/test/RequestTest.cc @@ -98,8 +98,13 @@ void RequestTest::testRedirectUri() req.supportsPersistentConnection(false); req.setUri("http://aria.rednoah.com:8080/aria2/index.html"); - bool v2 = req.redirectUri("http://aria.rednoah.co.jp/"); - CPPUNIT_ASSERT(v2); + // See port number is preserved. + CPPUNIT_ASSERT(req.redirectUri("/foo")); + CPPUNIT_ASSERT_EQUAL(std::string("http://aria.rednoah.com:8080/foo"), + req.getCurrentUri()); + CPPUNIT_ASSERT_EQUAL((unsigned int)1, req.getRedirectCount()); + + CPPUNIT_ASSERT(req.redirectUri("http://aria.rednoah.co.jp/")); // persistent connection flag is set to be true after redirection CPPUNIT_ASSERT(req.supportsPersistentConnection()); // uri must be the same @@ -118,20 +123,20 @@ void RequestTest::testRedirectUri() CPPUNIT_ASSERT_EQUAL(std::string(""), req.getFile()); CPPUNIT_ASSERT_EQUAL(std::string(""), req.getQuery()); // See redirect count is incremented. - CPPUNIT_ASSERT_EQUAL((unsigned int)1, req.getRedirectCount()); + CPPUNIT_ASSERT_EQUAL((unsigned int)2, req.getRedirectCount()); // Give abosulute path CPPUNIT_ASSERT(req.redirectUri("/abspath/to/file")); CPPUNIT_ASSERT_EQUAL(std::string("http://aria.rednoah.co.jp/abspath/to/file"), req.getCurrentUri()); - CPPUNIT_ASSERT_EQUAL((unsigned int)2, req.getRedirectCount()); + CPPUNIT_ASSERT_EQUAL((unsigned int)3, req.getRedirectCount()); // Give relative path CPPUNIT_ASSERT(req.redirectUri("relativepath/to/file")); CPPUNIT_ASSERT_EQUAL(std::string("http://aria.rednoah.co.jp/abspath/to/" "relativepath/to/file"), req.getCurrentUri()); - CPPUNIT_ASSERT_EQUAL((unsigned int)3, req.getRedirectCount()); + CPPUNIT_ASSERT_EQUAL((unsigned int)4, req.getRedirectCount()); } void RequestTest::testRedirectUri2() |
