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

Side by Side Diff: chrome/browser/extensions/api/web_request/web_request_api_helpers.cc

Issue 21907006: Fix invalid parsing of cookie in Web request helpers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix unittest Created 7 years, 4 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
« no previous file with comments | « no previous file | chrome/browser/extensions/api/web_request/web_request_api_unittest.cc » ('j') | 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) 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 #include "chrome/browser/extensions/api/web_request/web_request_api_helpers.h" 5 #include "chrome/browser/extensions/api/web_request/web_request_api_helpers.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 std::string::const_iterator cookie_name_beginning = i; 491 std::string::const_iterator cookie_name_beginning = i;
492 while (i != header_value.end() && *i != '=') ++i; 492 while (i != header_value.end() && *i != '=') ++i;
493 base::StringPiece cookie_name(cookie_name_beginning, i); 493 base::StringPiece cookie_name(cookie_name_beginning, i);
494 494
495 // Find cookie value. 495 // Find cookie value.
496 base::StringPiece cookie_value; 496 base::StringPiece cookie_value;
497 if (i != header_value.end()) { // Cookies may have no value. 497 if (i != header_value.end()) { // Cookies may have no value.
498 ++i; // Skip '='. 498 ++i; // Skip '='.
499 std::string::const_iterator cookie_value_beginning = i; 499 std::string::const_iterator cookie_value_beginning = i;
500 if (*i == '"') { 500 if (*i == '"') {
501 ++i; // Skip '"'.
501 while (i != header_value.end() && *i != '"') ++i; 502 while (i != header_value.end() && *i != '"') ++i;
502 if (i == header_value.end()) return; 503 if (i == header_value.end()) return;
503 ++i; // Skip '"'. 504 ++i; // Skip '"'.
504 cookie_value = base::StringPiece(cookie_value_beginning, i); 505 cookie_value = base::StringPiece(cookie_value_beginning, i);
505 // i points to character after '"', potentially a ';' 506 // i points to character after '"', potentially a ';'
506 } else { 507 } else {
507 while (i != header_value.end() && *i != ';') ++i; 508 while (i != header_value.end() && *i != ';') ++i;
508 cookie_value = base::StringPiece(cookie_value_beginning, i); 509 cookie_value = base::StringPiece(cookie_value_beginning, i);
509 // i points to ';' or end of string. 510 // i points to ';' or end of string.
510 } 511 }
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after
1271 for (content::RenderProcessHost::iterator it = 1272 for (content::RenderProcessHost::iterator it =
1272 content::RenderProcessHost::AllHostsIterator(); 1273 content::RenderProcessHost::AllHostsIterator();
1273 !it.IsAtEnd(); it.Advance()) { 1274 !it.IsAtEnd(); it.Advance()) {
1274 content::RenderProcessHost* host = it.GetCurrentValue(); 1275 content::RenderProcessHost* host = it.GetCurrentValue();
1275 if (host->GetBrowserContext() == browser_context) 1276 if (host->GetBrowserContext() == browser_context)
1276 SendExtensionWebRequestStatusToHost(host); 1277 SendExtensionWebRequestStatusToHost(host);
1277 } 1278 }
1278 } 1279 }
1279 1280
1280 } // namespace extension_web_request_api_helpers 1281 } // namespace extension_web_request_api_helpers
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/web_request/web_request_api_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698