mirror of https://github.com/aria2/aria2
Upgrade Chromium cookie store support to version 11
parent
9d0a48ac81
commit
d816ef7da4
|
@ -59,14 +59,20 @@ Sqlite3ChromiumCookieParser::~Sqlite3ChromiumCookieParser() = default;
|
||||||
|
|
||||||
const char* Sqlite3ChromiumCookieParser::getQuery() const
|
const char* Sqlite3ChromiumCookieParser::getQuery() const
|
||||||
{
|
{
|
||||||
// chrome's time is microsecond resolution, and its epoc is Jan 1
|
// Chrome stores time in microsecond resolution, and its epoch is Jan 1
|
||||||
// 00:00:00 +0000 1601, so we have to convert it to second from UNIX
|
// 00:00:00 +0000 1601, so we have to convert it to seconds from UNIX epoch.
|
||||||
// epoc. 11644473600 is the second between chrome's epoc and UNIX
|
// 11644473600 is the number of seconds between Chrome's epoch and the UNIX
|
||||||
// epoc. e.g., date +%s -d 'Jan 1 00:00:00 +0000 1601'
|
// epoch, e.g. `date +%s -d 'Jan 1 00:00:00 +0000 1601'`
|
||||||
return "SELECT host_key, path, secure, expires_utc / 1000000 - 11644473600 "
|
|
||||||
"as expires_utc, name, value, "
|
// Ideally, the SQLite3 cookie parser API would first run an identification
|
||||||
"last_access_utc / 1000000 - 11644473600 as last_access_utc"
|
// process to determine the format and version of the cookie store, but it's
|
||||||
" FROM cookies";
|
// not currently designed that way. The following query is specifically for
|
||||||
|
// Chromium cookie stores with latest_compatible_db_version = 11.
|
||||||
|
return ""
|
||||||
|
" SELECT host_key, path, is_secure, expires_utc / 1000000 - 11644473600 "
|
||||||
|
" as expires_utc, name, value, "
|
||||||
|
" last_access_utc / 1000000 - 11644473600 as last_access_utc "
|
||||||
|
" FROM cookies";
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace aria2
|
} // namespace aria2
|
||||||
|
|
Loading…
Reference in New Issue