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 // The rules for parsing content-types were borrowed from Firefox: | 5 // The rules for parsing content-types were borrowed from Firefox: |
6 // http://lxr.mozilla.org/mozilla/source/netwerk/base/src/nsURLHelper.cpp#834 | 6 // http://lxr.mozilla.org/mozilla/source/netwerk/base/src/nsURLHelper.cpp#834 |
7 | 7 |
8 #include "net/http/http_util.h" | 8 #include "net/http/http_util.h" |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 "transfer-encoding", | 346 "transfer-encoding", |
347 "upgrade", | 347 "upgrade", |
348 "user-agent", | 348 "user-agent", |
349 "via", | 349 "via", |
350 }; | 350 }; |
351 } // anonymous namespace | 351 } // anonymous namespace |
352 | 352 |
353 // static | 353 // static |
354 bool HttpUtil::IsSafeHeader(const std::string& name) { | 354 bool HttpUtil::IsSafeHeader(const std::string& name) { |
355 std::string lower_name(base::StringToLowerASCII(name)); | 355 std::string lower_name(base::StringToLowerASCII(name)); |
356 if (base::StartsWithASCII(lower_name, "proxy-", true) || | 356 if (base::StartsWith(lower_name, "proxy-", base::CompareCase::SENSITIVE) || |
357 base::StartsWithASCII(lower_name, "sec-", true)) | 357 base::StartsWith(lower_name, "sec-", base::CompareCase::SENSITIVE)) |
358 return false; | 358 return false; |
359 for (size_t i = 0; i < arraysize(kForbiddenHeaderFields); ++i) { | 359 for (size_t i = 0; i < arraysize(kForbiddenHeaderFields); ++i) { |
360 if (lower_name == kForbiddenHeaderFields[i]) | 360 if (lower_name == kForbiddenHeaderFields[i]) |
361 return false; | 361 return false; |
362 } | 362 } |
363 return true; | 363 return true; |
364 } | 364 } |
365 | 365 |
366 // static | 366 // static |
367 bool HttpUtil::IsValidHeaderName(const std::string& name) { | 367 bool HttpUtil::IsValidHeaderName(const std::string& name) { |
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
956 value_is_quoted_ = true; | 956 value_is_quoted_ = true; |
957 // Do not store iterators into this. See declaration of unquoted_value_. | 957 // Do not store iterators into this. See declaration of unquoted_value_. |
958 unquoted_value_ = HttpUtil::Unquote(value_begin_, value_end_); | 958 unquoted_value_ = HttpUtil::Unquote(value_begin_, value_end_); |
959 } | 959 } |
960 } | 960 } |
961 | 961 |
962 return true; | 962 return true; |
963 } | 963 } |
964 | 964 |
965 } // namespace net | 965 } // namespace net |
OLD | NEW |