2007-10-12 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

Do not send referer when redirected.
	* src/Request.cc (redirectUrl)
	* test/RequestTest.cc
	* test/HttpRequestTest.cc
pull/1/head
Tatsuhiro Tsujikawa 2007-10-11 17:04:53 +00:00
parent 048a2cf597
commit 1d5834a6ca
4 changed files with 14 additions and 8 deletions

View File

@ -1,3 +1,10 @@
2007-10-12 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Do not send referer when redirected.
* src/Request.cc (redirectUrl)
* test/RequestTest.cc
* test/HttpRequestTest.cc
2007-10-12 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Implemented BitTorrent/http/ftp integrated download.

View File

@ -60,7 +60,7 @@ bool Request::resetUrl() {
}
bool Request::redirectUrl(const string& url) {
previousUrl = currentUrl;
previousUrl = "";
return parseUrl(url);
}

View File

@ -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());

View File

@ -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() {