Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Side by Side Diff: net/base/cookie_monster.cc

Issue 597031: Avoid showing the user a garbage path attribute when the cookie doesn't have ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/base/cookie_monster.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Portions of this code based on Mozilla: 5 // Portions of this code based on Mozilla:
6 // (netwerk/cookie/src/nsCookieService.cpp) 6 // (netwerk/cookie/src/nsCookieService.cpp)
7 /* ***** BEGIN LICENSE BLOCK ***** 7 /* ***** BEGIN LICENSE BLOCK *****
8 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 8 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
9 * 9 *
10 * The contents of this file are subject to the Mozilla Public License Version 10 * The contents of this file are subject to the Mozilla Public License Version
11 * 1.1 (the "License"); you may not use this file except in compliance with 11 * 1.1 (the "License"); you may not use this file except in compliance with
(...skipping 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1128 for (PairList::const_iterator it = pairs_.begin(); 1128 for (PairList::const_iterator it = pairs_.begin();
1129 it != pairs_.end(); ++it) { 1129 it != pairs_.end(); ++it) {
1130 out.append(it->first); 1130 out.append(it->first);
1131 out.append("="); 1131 out.append("=");
1132 out.append(it->second); 1132 out.append(it->second);
1133 out.append("; "); 1133 out.append("; ");
1134 } 1134 }
1135 return out; 1135 return out;
1136 } 1136 }
1137 1137
1138 CookieMonster::CanonicalCookie::CanonicalCookie(const GURL& url,
1139 const ParsedCookie& pc)
1140 : name_(pc.Name()),
1141 value_(pc.Value()),
1142 path_(CanonPath(url, pc)),
1143 creation_date_(Time::Now()),
1144 last_access_date_(Time()),
1145 has_expires_(pc.HasExpires()),
1146 secure_(pc.IsSecure()),
1147 httponly_(pc.IsHttpOnly()) {
1148 if (has_expires_)
1149 expiry_date_ = CanonExpiration(pc, creation_date_, CookieOptions());
1150 }
1151
1138 bool CookieMonster::CanonicalCookie::IsOnPath( 1152 bool CookieMonster::CanonicalCookie::IsOnPath(
1139 const std::string& url_path) const { 1153 const std::string& url_path) const {
1140 1154
1141 // A zero length would be unsafe for our trailing '/' checks, and 1155 // A zero length would be unsafe for our trailing '/' checks, and
1142 // would also make no sense for our prefix match. The code that 1156 // would also make no sense for our prefix match. The code that
1143 // creates a CanonicalCookie should make sure the path is never zero length, 1157 // creates a CanonicalCookie should make sure the path is never zero length,
1144 // but we double check anyway. 1158 // but we double check anyway.
1145 if (path_.empty()) 1159 if (path_.empty())
1146 return false; 1160 return false;
1147 1161
(...skipping 23 matching lines...) Expand all
1171 return true; 1185 return true;
1172 } 1186 }
1173 1187
1174 std::string CookieMonster::CanonicalCookie::DebugString() const { 1188 std::string CookieMonster::CanonicalCookie::DebugString() const {
1175 return StringPrintf("name: %s value: %s path: %s creation: %" PRId64, 1189 return StringPrintf("name: %s value: %s path: %s creation: %" PRId64,
1176 name_.c_str(), value_.c_str(), path_.c_str(), 1190 name_.c_str(), value_.c_str(), path_.c_str(),
1177 static_cast<int64>(creation_date_.ToTimeT())); 1191 static_cast<int64>(creation_date_.ToTimeT()));
1178 } 1192 }
1179 1193
1180 } // namespace 1194 } // namespace
OLDNEW
« no previous file with comments | « net/base/cookie_monster.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698