OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 (*i >= 0x2D && *i <= 0x3A) || | 130 (*i >= 0x2D && *i <= 0x3A) || |
131 (*i >= 0x3C && *i <= 0x5B) || | 131 (*i >= 0x3C && *i <= 0x5B) || |
132 (*i >= 0x5D && *i <= 0x7E)); | 132 (*i >= 0x5D && *i <= 0x7E)); |
133 if (!valid_octet) | 133 if (!valid_octet) |
134 return false; | 134 return false; |
135 } | 135 } |
136 return true; | 136 return true; |
137 } | 137 } |
138 | 138 |
139 bool IsControlCharacter(unsigned char c) { | 139 bool IsControlCharacter(unsigned char c) { |
140 return (c >= 0) && (c <= 31); | 140 return c <= 31; |
141 } | 141 } |
142 | 142 |
143 bool IsValidCookieAttributeValue(const std::string& value) { | 143 bool IsValidCookieAttributeValue(const std::string& value) { |
144 // The greatest common denominator of cookie attribute values is | 144 // The greatest common denominator of cookie attribute values is |
145 // <any CHAR except CTLs or ";"> according to RFC 6265. | 145 // <any CHAR except CTLs or ";"> according to RFC 6265. |
146 for (std::string::const_iterator i = value.begin(); i != value.end(); ++i) { | 146 for (std::string::const_iterator i = value.begin(); i != value.end(); ++i) { |
147 if (IsControlCharacter(*i) || *i == ';') | 147 if (IsControlCharacter(*i) || *i == ';') |
148 return false; | 148 return false; |
149 } | 149 } |
150 return true; | 150 return true; |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 for (size_t i = 0; i < arraysize(indexes); ++i) { | 489 for (size_t i = 0; i < arraysize(indexes); ++i) { |
490 if (*indexes[i] == index) | 490 if (*indexes[i] == index) |
491 *indexes[i] = 0; | 491 *indexes[i] = 0; |
492 else if (*indexes[i] > index) | 492 else if (*indexes[i] > index) |
493 --*indexes[i]; | 493 --*indexes[i]; |
494 } | 494 } |
495 pairs_.erase(pairs_.begin() + index); | 495 pairs_.erase(pairs_.begin() + index); |
496 } | 496 } |
497 | 497 |
498 } // namespace | 498 } // namespace |
OLD | NEW |