summaryrefslogtreecommitdiff
path: root/test/HttpRequestTest.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2010-10-09 14:22:49 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2010-10-09 14:22:49 +0000
commit8b17d4b276222b203722eea9ded9cd3797a4b656 (patch)
treefd20f43edf2e3891707cbff18bd1f7160cf627d2 /test/HttpRequestTest.cc
parent9b1280f7a3c0d0223ad8bbc20e108b776d9c53af (diff)
2010-10-09 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Rewritten Cookie class and Cookie parser based on http://tools.ietf.org/html/draft-ietf-httpstate-cookie-14 with some modifications. When parsing cookie date, match time first so that it parses asctime() format. The request-path must be ends with '/' so that request-path '/foo/' path-matches cookie-path '/foo' and '/foo/' in the proposed algorithm. * src/Cookie.cc * src/Cookie.h * src/CookieParser.cc: Removed * src/CookieParser.h: Removed * src/CookieStorage.cc * src/CookieStorage.h * src/HttpResponse.cc * src/Makefile.am * src/Makefile.in * src/MultiUrlRequestInfo.cc * src/NsCookieParser.cc * src/NsCookieParser.h * src/Sqlite3CookieParser.cc * src/Sqlite3CookieParser.h * src/a2functional.h * src/cookie_helper.cc * src/cookie_helper.h * src/util.cc * src/util.h * test/CookieBoxFactoryTest.cc: Removed * test/CookieHelperTest.cc * test/CookieParserTest.cc: Removed * test/CookieStorageTest.cc * test/CookieTest.cc * test/HttpRequestTest.cc * test/Makefile.am * test/Makefile.in * test/NsCookieParserTest.cc * test/Sqlite3CookieParserTest.cc * test/TestUtil.cc * test/TestUtil.h * test/a2functionalTest.cc * test/chromium_cookies.sqlite * test/cookies.sqlite * test/nscookietest.txt
Diffstat (limited to 'test/HttpRequestTest.cc')
-rw-r--r--test/HttpRequestTest.cc22
1 files changed, 14 insertions, 8 deletions
diff --git a/test/HttpRequestTest.cc b/test/HttpRequestTest.cc
index 8ce25b83..8f73ceb4 100644
--- a/test/HttpRequestTest.cc
+++ b/test/HttpRequestTest.cc
@@ -15,6 +15,7 @@
#include "CookieStorage.h"
#include "util.h"
#include "AuthConfig.h"
+#include "TestUtil.h"
namespace aria2 {
@@ -380,16 +381,21 @@ void HttpRequestTest::testCreateRequest_with_cookie()
(new PiecedSegment(1024*1024, p));
SharedHandle<FileEntry> fileEntry(new FileEntry("file", 1024*1024*10, 0));
- Cookie cookie1("name1", "value1", "/archives", "localhost", false);
- Cookie cookie2("name2", "value2", "/archives/download", "localhost", false);
- Cookie cookie3("name3", "value3", "/archives/download", ".aria2.org", false);
- Cookie cookie4("name4", "value4", "/archives/", ".aria2.org", true);
+ Cookie cookie1(createCookie("name1", "value1", "localhost", true,
+ "/archives", false));
+ Cookie cookie2(createCookie("name2", "value2", "localhost", true,
+ "/archives/download", false));
+ Cookie cookie3(createCookie("name3", "value3", "aria2.org", false,
+ "/archives/download", false));
+ Cookie cookie4(createCookie("name4", "value4", "aria2.org", false,
+ "/archives/", true));
+ time_t now = time(0);
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));
+ CPPUNIT_ASSERT(st->store(cookie1, now));
+ CPPUNIT_ASSERT(st->store(cookie2, now));
+ CPPUNIT_ASSERT(st->store(cookie3, now));
+ CPPUNIT_ASSERT(st->store(cookie4, now));
HttpRequest httpRequest;