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 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 | 391 |
392 // OK, now try to parse a value. | 392 // OK, now try to parse a value. |
393 std::string::const_iterator value_start, value_end; | 393 std::string::const_iterator value_start, value_end; |
394 ParseValue(&it, end, &value_start, &value_end); | 394 ParseValue(&it, end, &value_start, &value_end); |
395 | 395 |
396 // OK, we're finished with a Token/Value. | 396 // OK, we're finished with a Token/Value. |
397 pair.second = std::string(value_start, value_end); | 397 pair.second = std::string(value_start, value_end); |
398 | 398 |
399 // From RFC2109: "Attributes (names) (attr) are case-insensitive." | 399 // From RFC2109: "Attributes (names) (attr) are case-insensitive." |
400 if (pair_num != 0) | 400 if (pair_num != 0) |
401 base::StringToLowerASCII(&pair.first); | 401 pair.first = base::ToLowerASCII(pair.first); |
402 // Ignore Set-Cookie directives contaning control characters. See | 402 // Ignore Set-Cookie directives contaning control characters. See |
403 // http://crbug.com/238041. | 403 // http://crbug.com/238041. |
404 if (!IsValidCookieAttributeValue(pair.first) || | 404 if (!IsValidCookieAttributeValue(pair.first) || |
405 !IsValidCookieAttributeValue(pair.second)) { | 405 !IsValidCookieAttributeValue(pair.second)) { |
406 pairs_.clear(); | 406 pairs_.clear(); |
407 break; | 407 break; |
408 } | 408 } |
409 | 409 |
410 pairs_.push_back(pair); | 410 pairs_.push_back(pair); |
411 | 411 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 for (size_t i = 0; i < arraysize(indexes); ++i) { | 501 for (size_t i = 0; i < arraysize(indexes); ++i) { |
502 if (*indexes[i] == index) | 502 if (*indexes[i] == index) |
503 *indexes[i] = 0; | 503 *indexes[i] = 0; |
504 else if (*indexes[i] > index) | 504 else if (*indexes[i] > index) |
505 --*indexes[i]; | 505 --*indexes[i]; |
506 } | 506 } |
507 pairs_.erase(pairs_.begin() + index); | 507 pairs_.erase(pairs_.begin() + index); |
508 } | 508 } |
509 | 509 |
510 } // namespace | 510 } // namespace |
OLD | NEW |