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 #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 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 void* iter = NULL; | 340 void* iter = NULL; |
341 std::string name; | 341 std::string name; |
342 std::string value; | 342 std::string value; |
343 while (old_response_headers->EnumerateHeaderLines(&iter, &name, &value)) { | 343 while (old_response_headers->EnumerateHeaderLines(&iter, &name, &value)) { |
344 std::string name_lowercase(name); | 344 std::string name_lowercase(name); |
345 base::StringToLowerASCII(&name_lowercase); | 345 base::StringToLowerASCII(&name_lowercase); |
346 | 346 |
347 bool header_found = false; | 347 bool header_found = false; |
348 for (ResponseHeaders::const_iterator i = new_response_headers->begin(); | 348 for (ResponseHeaders::const_iterator i = new_response_headers->begin(); |
349 i != new_response_headers->end(); ++i) { | 349 i != new_response_headers->end(); ++i) { |
350 if (base::LowerCaseEqualsASCII(i->first, name_lowercase.c_str()) && | 350 if (LowerCaseEqualsASCII(i->first, name_lowercase.c_str()) && |
351 value == i->second) { | 351 value == i->second) { |
352 header_found = true; | 352 header_found = true; |
353 break; | 353 break; |
354 } | 354 } |
355 } | 355 } |
356 if (!header_found) | 356 if (!header_found) |
357 result->deleted_response_headers.push_back(ResponseHeader(name, value)); | 357 result->deleted_response_headers.push_back(ResponseHeader(name, value)); |
358 } | 358 } |
359 } | 359 } |
360 | 360 |
(...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1247 return net::HttpUtil::IsToken(name); | 1247 return net::HttpUtil::IsToken(name); |
1248 } | 1248 } |
1249 | 1249 |
1250 bool IsValidHeaderValue(const std::string& value) { | 1250 bool IsValidHeaderValue(const std::string& value) { |
1251 // Just a sanity check: disallow NUL and CRLF. | 1251 // Just a sanity check: disallow NUL and CRLF. |
1252 return value.find('\0') == std::string::npos && | 1252 return value.find('\0') == std::string::npos && |
1253 value.find("\r\n") == std::string::npos; | 1253 value.find("\r\n") == std::string::npos; |
1254 } | 1254 } |
1255 | 1255 |
1256 } // namespace extension_web_request_api_helpers | 1256 } // namespace extension_web_request_api_helpers |
OLD | NEW |