mirror of
https://github.com/aria2/aria2.git
synced 2025-01-24 02:31:29 +00:00
8b17d4b276
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
43 lines
808 B
C++
43 lines
808 B
C++
#include "common.h"
|
|
|
|
#include <string>
|
|
|
|
#include "Cookie.h"
|
|
|
|
namespace aria2 {
|
|
|
|
void createFile(const std::string& filename, size_t length);
|
|
|
|
std::string readFile(const std::string& path);
|
|
|
|
class CookieSorter {
|
|
public:
|
|
bool operator()(const Cookie& lhs, const Cookie& rhs) const
|
|
{
|
|
if(lhs.getDomain() == rhs.getDomain()) {
|
|
return lhs.getName() < rhs.getName();
|
|
} else {
|
|
return lhs.getDomain() < rhs.getDomain();
|
|
}
|
|
}
|
|
};
|
|
|
|
Cookie createCookie
|
|
(const std::string& name,
|
|
const std::string& value,
|
|
const std::string& domain,
|
|
bool hostOnly,
|
|
const std::string& path,
|
|
bool secure);
|
|
|
|
Cookie createCookie
|
|
(const std::string& name,
|
|
const std::string& value,
|
|
time_t expiryTime,
|
|
const std::string& domain,
|
|
bool hostOnly,
|
|
const std::string& path,
|
|
bool secure);
|
|
|
|
} // namespace aria2
|