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

Unified Diff: chrome/browser/extensions/api/declarative_webrequest/webrequest_action.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, 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/extensions/api/downloads/downloads_api.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/declarative_webrequest/webrequest_action.cc
diff --git a/chrome/browser/extensions/api/declarative_webrequest/webrequest_action.cc b/chrome/browser/extensions/api/declarative_webrequest/webrequest_action.cc
index ddba91ce7501ee137ad6dbd0e9ce785abf68a8f7..0056333abb135aa9d18582a9ce5b0b1da37845ee 100644
--- a/chrome/browser/extensions/api/declarative_webrequest/webrequest_action.cc
+++ b/chrome/browser/extensions/api/declarative_webrequest/webrequest_action.cc
@@ -25,6 +25,7 @@
#include "extensions/common/error_utils.h"
#include "extensions/common/extension.h"
#include "net/base/registry_controlled_domains/registry_controlled_domain.h"
+#include "net/http/http_util.h"
#include "net/url_request/url_request.h"
#include "third_party/re2/re2/re2.h"
@@ -172,11 +173,11 @@ scoped_refptr<const WebRequestAction> CreateSetRequestHeaderAction(
std::string value;
INPUT_FORMAT_VALIDATE(dict->GetString(keys::kNameKey, &name));
INPUT_FORMAT_VALIDATE(dict->GetString(keys::kValueKey, &value));
- if (!helpers::IsValidHeaderName(name)) {
+ if (!net::HttpUtil::IsValidHeaderName(name)) {
*error = extension_web_request_api_constants::kInvalidHeaderName;
return scoped_refptr<const WebRequestAction>(NULL);
}
- if (!helpers::IsValidHeaderValue(value)) {
+ if (!net::HttpUtil::IsValidHeaderValue(value)) {
*error = ErrorUtils::FormatErrorMessage(
extension_web_request_api_constants::kInvalidHeaderValue, name);
return scoped_refptr<const WebRequestAction>(NULL);
@@ -194,7 +195,7 @@ scoped_refptr<const WebRequestAction> CreateRemoveRequestHeaderAction(
CHECK(value->GetAsDictionary(&dict));
std::string name;
INPUT_FORMAT_VALIDATE(dict->GetString(keys::kNameKey, &name));
- if (!helpers::IsValidHeaderName(name)) {
+ if (!net::HttpUtil::IsValidHeaderName(name)) {
*error = extension_web_request_api_constants::kInvalidHeaderName;
return scoped_refptr<const WebRequestAction>(NULL);
}
@@ -213,11 +214,11 @@ scoped_refptr<const WebRequestAction> CreateAddResponseHeaderAction(
std::string value;
INPUT_FORMAT_VALIDATE(dict->GetString(keys::kNameKey, &name));
INPUT_FORMAT_VALIDATE(dict->GetString(keys::kValueKey, &value));
- if (!helpers::IsValidHeaderName(name)) {
+ if (!net::HttpUtil::IsValidHeaderName(name)) {
*error = extension_web_request_api_constants::kInvalidHeaderName;
return scoped_refptr<const WebRequestAction>(NULL);
}
- if (!helpers::IsValidHeaderValue(value)) {
+ if (!net::HttpUtil::IsValidHeaderValue(value)) {
*error = ErrorUtils::FormatErrorMessage(
extension_web_request_api_constants::kInvalidHeaderValue, name);
return scoped_refptr<const WebRequestAction>(NULL);
@@ -237,11 +238,11 @@ scoped_refptr<const WebRequestAction> CreateRemoveResponseHeaderAction(
std::string value;
INPUT_FORMAT_VALIDATE(dict->GetString(keys::kNameKey, &name));
bool has_value = dict->GetString(keys::kValueKey, &value);
- if (!helpers::IsValidHeaderName(name)) {
+ if (!net::HttpUtil::IsValidHeaderName(name)) {
*error = extension_web_request_api_constants::kInvalidHeaderName;
return scoped_refptr<const WebRequestAction>(NULL);
}
- if (has_value && !helpers::IsValidHeaderValue(value)) {
+ if (has_value && !net::HttpUtil::IsValidHeaderValue(value)) {
*error = ErrorUtils::FormatErrorMessage(
extension_web_request_api_constants::kInvalidHeaderValue, name);
return scoped_refptr<const WebRequestAction>(NULL);
« no previous file with comments | « no previous file | chrome/browser/extensions/api/downloads/downloads_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698