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

Side by Side Diff: net/http/http_util.cc

Issue 1172183002: Move StartsWith[ASCII] to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@string_util3
Patch Set: merger Created 5 years, 6 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 | « net/http/http_stream_factory.cc ('k') | net/proxy/proxy_bypass_rules.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 // 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
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 (StartsWithASCII(lower_name, "proxy-", true) || 356 if (base::StartsWithASCII(lower_name, "proxy-", true) ||
357 StartsWithASCII(lower_name, "sec-", true)) 357 base::StartsWithASCII(lower_name, "sec-", true))
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
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
OLDNEW
« no previous file with comments | « net/http/http_stream_factory.cc ('k') | net/proxy/proxy_bypass_rules.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698