Index: net/cookies/canonical_cookie.cc |
diff --git a/net/cookies/canonical_cookie.cc b/net/cookies/canonical_cookie.cc |
index 5ae65f67b5868252f351b9c16e07a9a7f4ca9592..306b8fc21729e9f7ba2739f4946b7c49504a7d23 100644 |
--- a/net/cookies/canonical_cookie.cc |
+++ b/net/cookies/canonical_cookie.cc |
@@ -139,7 +139,7 @@ CanonicalCookie::CanonicalCookie(const GURL& url, const ParsedCookie& pc) |
secure_(pc.IsSecure()), |
httponly_(pc.IsHttpOnly()) { |
if (pc.HasExpires()) |
- expiry_date_ = CanonExpiration(pc, creation_date_); |
+ expiry_date_ = CanonExpiration(pc, creation_date_, creation_date_); |
// Do the best we can with the domain. |
std::string cookie_domain; |
@@ -181,7 +181,8 @@ std::string CanonicalCookie::CanonPath(const GURL& url, |
// static |
Time CanonicalCookie::CanonExpiration(const ParsedCookie& pc, |
- const Time& current) { |
+ const Time& current, |
+ const Time& server_time) { |
// First, try the Max-Age attribute. |
uint64 max_age = 0; |
if (pc.HasMaxAge() && |
@@ -195,8 +196,10 @@ Time CanonicalCookie::CanonExpiration(const ParsedCookie& pc, |
} |
// Try the Expires attribute. |
- if (pc.HasExpires()) |
- return cookie_util::ParseCookieTime(pc.Expires()); |
+ if (pc.HasExpires()) { |
+ // Adjust for clock skew between server and host. |
+ return current + (cookie_util::ParseCookieTime(pc.Expires()) - server_time); |
+ } |
// Invalid or no expiration, persistent cookie. |
return Time(); |