diff options
author | pauljensen@chromium.org <pauljensen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-13 19:27:48 +0000 |
---|---|---|
committer | pauljensen@chromium.org <pauljensen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-13 19:27:48 +0000 |
commit | bb3c4c5de24a6732e6f13f96935eea8cb1392c04 (patch) | |
tree | fb2b7ca0ed7ca8164b849c0824c01ff8e498c2cf /net/cookies/cookie_options.h | |
parent | 052f0983c534482292715f256fc99df4996ae6e7 (diff) | |
download | chromium_src-bb3c4c5de24a6732e6f13f96935eea8cb1392c04.zip chromium_src-bb3c4c5de24a6732e6f13f96935eea8cb1392c04.tar.gz chromium_src-bb3c4c5de24a6732e6f13f96935eea8cb1392c04.tar.bz2 |
Account for server vs host clock skew in cookie expiration times.
When setting a cookie's expiration time in the cookie store we need
to take into account any difference between the HTTP server and the
host machine's real time clock.
BUG=135131
TEST=net_unittests --gtest_filter=CookieMonster/CookieStoreTest/0.TestCookieDeletion
Review URL: https://chromiumcodereview.appspot.com/10692137
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146616 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/cookies/cookie_options.h')
-rw-r--r-- | net/cookies/cookie_options.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/net/cookies/cookie_options.h b/net/cookies/cookie_options.h index 8370702..ed5e2ef 100644 --- a/net/cookies/cookie_options.h +++ b/net/cookies/cookie_options.h @@ -15,15 +15,26 @@ class CookieOptions { // - reading operations will not return httponly cookies. // - writing operations will not write httponly cookies. CookieOptions() - : exclude_httponly_(true) { + : exclude_httponly_(true), + server_time_() { } void set_exclude_httponly() { exclude_httponly_ = true; } void set_include_httponly() { exclude_httponly_ = false; } bool exclude_httponly() const { return exclude_httponly_; } + // |server_time| indicates what the server sending us the Cookie thought the + // current time was when the cookie was produced. This is used to adjust for + // clock skew between server and host. + void set_server_time(const base::Time& server_time) { + server_time_ = server_time; + } + bool has_server_time() const { return !server_time_.is_null(); } + base::Time server_time() const { return server_time_; } + private: bool exclude_httponly_; + base::Time server_time_; }; } // namespace net |