diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-12 23:55:47 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-12 23:55:47 +0000 |
commit | a986cc3e3f196cb36b7b81d66924f8ad148f2517 (patch) | |
tree | 32e0d4484f1c470a6dce956446962471e3e0ba77 /net/base | |
parent | a9d0a80333a74df153dfd41dbbaff2e844b2d751 (diff) | |
download | chromium_src-a986cc3e3f196cb36b7b81d66924f8ad148f2517.zip chromium_src-a986cc3e3f196cb36b7b81d66924f8ad148f2517.tar.gz chromium_src-a986cc3e3f196cb36b7b81d66924f8ad148f2517.tar.bz2 |
Avoid showing the user a garbage path attribute when the cookie doesn't have an
explicit path set. This CL also ensures that we set the expiry info properly.
This means using CanonPath and CanonExpiration from cookie_monster.cc. Instead
of exposing those methods, I just expose a CanonicalCookie constructor that
takes a ParsedCookie.
R=pkasting
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/597031
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38984 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base')
-rw-r--r-- | net/base/cookie_monster.cc | 14 | ||||
-rw-r--r-- | net/base/cookie_monster.h | 3 |
2 files changed, 16 insertions, 1 deletions
diff --git a/net/base/cookie_monster.cc b/net/base/cookie_monster.cc index 1b37f48..50ffcac 100644 --- a/net/base/cookie_monster.cc +++ b/net/base/cookie_monster.cc @@ -1254,6 +1254,20 @@ std::string CookieMonster::ParsedCookie::DebugString() const { return out; } +CookieMonster::CanonicalCookie::CanonicalCookie(const GURL& url, + const ParsedCookie& pc) + : name_(pc.Name()), + value_(pc.Value()), + path_(CanonPath(url, pc)), + creation_date_(Time::Now()), + last_access_date_(Time()), + has_expires_(pc.HasExpires()), + secure_(pc.IsSecure()), + httponly_(pc.IsHttpOnly()) { + if (has_expires_) + expiry_date_ = CanonExpiration(pc, creation_date_, CookieOptions()); +} + bool CookieMonster::CanonicalCookie::IsOnPath( const std::string& url_path) const { diff --git a/net/base/cookie_monster.h b/net/base/cookie_monster.h index f944842..ccdae0b 100644 --- a/net/base/cookie_monster.h +++ b/net/base/cookie_monster.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -329,6 +329,7 @@ class CookieMonster::CanonicalCookie { secure_(secure), httponly_(httponly) { } + CanonicalCookie(const GURL& url, const ParsedCookie& pc); // Supports the default copy constructor. |