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

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

Issue 491123004: Make sure that HttpRequestHeaders contains valid key-value pairs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: edit comment Created 6 years, 3 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
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 1224 matching lines...) Expand 10 before | Expand all | Expand 10 after
1235 content::BrowserContext* browser_context = profile; 1235 content::BrowserContext* browser_context = profile;
1236 for (content::RenderProcessHost::iterator it = 1236 for (content::RenderProcessHost::iterator it =
1237 content::RenderProcessHost::AllHostsIterator(); 1237 content::RenderProcessHost::AllHostsIterator();
1238 !it.IsAtEnd(); it.Advance()) { 1238 !it.IsAtEnd(); it.Advance()) {
1239 content::RenderProcessHost* host = it.GetCurrentValue(); 1239 content::RenderProcessHost* host = it.GetCurrentValue();
1240 if (host->GetBrowserContext() == browser_context) 1240 if (host->GetBrowserContext() == browser_context)
1241 SendExtensionWebRequestStatusToHost(host); 1241 SendExtensionWebRequestStatusToHost(host);
1242 } 1242 }
1243 } 1243 }
1244 1244
1245 bool IsValidHeaderName(const std::string& name) {
1246 // Check whether the header name is RFC 2616-compliant.
1247 return net::HttpUtil::IsToken(name);
1248 }
1249
1250 bool IsValidHeaderValue(const std::string& value) {
1251 // Just a sanity check: disallow NUL and CRLF.
1252 return value.find('\0') == std::string::npos &&
1253 value.find("\r\n") == std::string::npos;
1254 }
1255
1256 } // namespace extension_web_request_api_helpers 1245 } // namespace extension_web_request_api_helpers
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/web_request/web_request_api_helpers.h ('k') | chrome/common/chrome_content_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698