diff --git a/ChangeLog b/ChangeLog index 26b60622..d35466db 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-10-12 Tatsuhiro Tsujikawa + + Do not send referer when redirected. + * src/Request.cc (redirectUrl) + * test/RequestTest.cc + * test/HttpRequestTest.cc + 2007-10-12 Tatsuhiro Tsujikawa Implemented BitTorrent/http/ftp integrated download. diff --git a/src/Request.cc b/src/Request.cc index bf8893f3..c9507d58 100644 --- a/src/Request.cc +++ b/src/Request.cc @@ -60,7 +60,7 @@ bool Request::resetUrl() { } bool Request::redirectUrl(const string& url) { - previousUrl = currentUrl; + previousUrl = ""; return parseUrl(url); } diff --git a/test/HttpRequestTest.cc b/test/HttpRequestTest.cc index 38df5480..002f2260 100644 --- a/test/HttpRequestTest.cc +++ b/test/HttpRequestTest.cc @@ -171,7 +171,6 @@ void HttpRequestTest::testCreateRequest() "Cache-Control: no-cache\r\n" "Connection: close\r\n" "Range: bytes=1048576-\r\n" - "Referer: http://localhost:8080/archives/aria2-1.0.0.tar.bz2\r\n" "\r\n"; CPPUNIT_ASSERT_EQUAL(expectedText, httpRequest.createRequest()); diff --git a/test/RequestTest.cc b/test/RequestTest.cc index c026e8c1..bc2c9913 100644 --- a/test/RequestTest.cc +++ b/test/RequestTest.cc @@ -228,8 +228,8 @@ void RequestTest::testRedirectUrl() { req.getUrl()); // currentUrl must be updated CPPUNIT_ASSERT_EQUAL(string("http://aria.rednoah.co.jp/"), req.getCurrentUrl()); - // previousUrl must be updated - CPPUNIT_ASSERT_EQUAL(string("http://aria.rednoah.com:8080/aria2/index.html"), req.getPreviousUrl()); + // previousUrl must be "" when redirection + CPPUNIT_ASSERT_EQUAL(string(""), req.getPreviousUrl()); CPPUNIT_ASSERT_EQUAL(string("http"), req.getProtocol()); CPPUNIT_ASSERT_EQUAL(string("aria.rednoah.co.jp"), req.getHost()); CPPUNIT_ASSERT_EQUAL((int32_t)80, req.getPort()); @@ -246,15 +246,15 @@ void RequestTest::testRedirectUrl2() { CPPUNIT_ASSERT_EQUAL(string("http://aria.rednoah.com/"), req.getPreviousUrl()); bool v2 = req.redirectUrl("http://aria.rednoah.com/403.html"); - // previousUrl is updated - CPPUNIT_ASSERT_EQUAL(string("http://aria.rednoah.com/download.html"), req.getPreviousUrl()); + // previousUrl must be "" when redirection + CPPUNIT_ASSERT_EQUAL(string(""), req.getPreviousUrl()); // referer is unchagned CPPUNIT_ASSERT_EQUAL(string("http://aria.rednoah.com/"), req.getReferer()); bool v3 = req.redirectUrl("http://aria.rednoah.com/error.html"); - // previousUrl is update - CPPUNIT_ASSERT_EQUAL(string("http://aria.rednoah.com/403.html"), req.getPreviousUrl()); + // previousUrl must be "" when redirection + CPPUNIT_ASSERT_EQUAL(string(""), req.getPreviousUrl()); } void RequestTest::testResetUrl() {