diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2008-09-01 13:46:03 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2008-09-01 13:46:03 +0000 |
| commit | 398d53f5f5073d6bc7d4ac788ea202281f766524 (patch) | |
| tree | c28aed260915c3a06d0ec90912888bcff769b4d5 /test/HttpRequestTest.cc | |
| parent | f670cdbba906c0d7a014e7d86026cb408b7eda30 (diff) | |
2008-09-01 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Use CookieStorage class instead of CookieBox class.
Now CookieStorage accepts cookies from numeric host such as
192.168.1.1.
* src/AbstractProxyRequestCommand.cc
* src/CookieStorage.cc
* src/DownloadEngine.cc
* src/DownloadEngine.h
* src/HttpConnection.cc
* src/HttpConnection.h
* src/HttpRequest.cc
* src/HttpRequest.h
* src/HttpRequestCommand.cc
* src/HttpResponse.cc
* src/HttpResponseCommand.cc
* src/HttpSkipResponseCommand.cc
* src/Makefile.am
* src/MultiUrlRequestInfo.cc
* src/Request.cc
* src/Request.h
* src/main.cc
* test/AllTest.cc
* test/CookieStorageTest.cc
* test/CookieTest.cc
* test/HttpRequestTest.cc
* test/HttpResponseTest.cc
* test/Makefile.am
* test/NsCookieParserTest.cc
* test/Sqlite3MozCookieParserTest.cc
* test/nscookietest.txt
Diffstat (limited to 'test/HttpRequestTest.cc')
| -rw-r--r-- | test/HttpRequestTest.cc | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/test/HttpRequestTest.cc b/test/HttpRequestTest.cc index 411fcde9..12491548 100644 --- a/test/HttpRequestTest.cc +++ b/test/HttpRequestTest.cc @@ -5,9 +5,9 @@ #include "Piece.h" #include "Range.h" #include "Request.h" -#include "CookieBox.h" #include "Option.h" #include "array_fun.h" +#include "CookieStorage.h" #include <cppunit/extensions/HelperMacros.h> namespace aria2 { @@ -396,19 +396,21 @@ void HttpRequestTest::testCreateRequest_with_cookie() Cookie cookie1("name1", "value1", "/archives", "localhost", false); Cookie cookie2("name2", "value2", "/archives/download", "localhost", false); - Cookie cookie3("name3", "value3", "/archives/download", "tt.localhost", false); - Cookie cookie4("name4", "value4", "/archives/download", "tt.localhost", true); + Cookie cookie3("name3", "value3", "/archives/download", ".aria2.org", false); + Cookie cookie4("name4", "value4", "/archives/", ".aria2.org", true); - request->cookieBox->add(cookie1); - request->cookieBox->add(cookie2); - request->cookieBox->add(cookie3); - request->cookieBox->add(cookie4); + SharedHandle<CookieStorage> st(new CookieStorage()); + CPPUNIT_ASSERT(st->store(cookie1)); + CPPUNIT_ASSERT(st->store(cookie2)); + CPPUNIT_ASSERT(st->store(cookie3)); + CPPUNIT_ASSERT(st->store(cookie4)); HttpRequest httpRequest; httpRequest.disableContentEncoding(); httpRequest.setRequest(request); httpRequest.setSegment(segment); + httpRequest.setCookieStorage(st); std::string expectedText = "GET /archives/aria2-1.0.0.tar.bz2 HTTP/1.1\r\n" "User-Agent: aria2\r\n" @@ -431,35 +433,36 @@ void HttpRequestTest::testCreateRequest_with_cookie() "Pragma: no-cache\r\n" "Cache-Control: no-cache\r\n" "Connection: close\r\n" - "Cookie: name1=value1;name2=value2;\r\n" + "Cookie: name2=value2;name1=value1;\r\n" "\r\n"; CPPUNIT_ASSERT_EQUAL(expectedText, httpRequest.createRequest()); - request->setUrl("http://tt.localhost/archives/download/aria2-1.0.0.tar.bz2"); + request->setUrl("http://www.aria2.org/archives/download/aria2-1.0.0.tar.bz2"); expectedText = "GET /archives/download/aria2-1.0.0.tar.bz2 HTTP/1.1\r\n" "User-Agent: aria2\r\n" "Accept: */*\r\n" - "Host: tt.localhost\r\n" + "Host: www.aria2.org\r\n" "Pragma: no-cache\r\n" "Cache-Control: no-cache\r\n" "Connection: close\r\n" - "Cookie: name1=value1;name2=value2;name3=value3;\r\n" + "Cookie: name3=value3;\r\n" "\r\n"; CPPUNIT_ASSERT_EQUAL(expectedText, httpRequest.createRequest()); - request->setUrl("https://tt.localhost/archives/download/aria2-1.0.0.tar.bz2"); + request->setUrl("https://www.aria2.org/archives/download/" + "aria2-1.0.0.tar.bz2"); expectedText = "GET /archives/download/aria2-1.0.0.tar.bz2 HTTP/1.1\r\n" "User-Agent: aria2\r\n" "Accept: */*\r\n" - "Host: tt.localhost\r\n" + "Host: www.aria2.org\r\n" "Pragma: no-cache\r\n" "Cache-Control: no-cache\r\n" "Connection: close\r\n" - "Cookie: name1=value1;name2=value2;name3=value3;name4=value4;\r\n" + "Cookie: name3=value3;name4=value4;\r\n" "\r\n"; CPPUNIT_ASSERT_EQUAL(expectedText, httpRequest.createRequest()); |
