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

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

Issue 4366001: base: Move CaseInsensitiveCompare traits into the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « net/http/http_response_headers.cc ('k') | net/url_request/url_request_unittest.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 } 285 }
286 286
287 // static 287 // static
288 bool HttpUtil::HasHeader(const std::string& headers, const char* name) { 288 bool HttpUtil::HasHeader(const std::string& headers, const char* name) {
289 size_t name_len = strlen(name); 289 size_t name_len = strlen(name);
290 string::const_iterator it = 290 string::const_iterator it =
291 std::search(headers.begin(), 291 std::search(headers.begin(),
292 headers.end(), 292 headers.end(),
293 name, 293 name,
294 name + name_len, 294 name + name_len,
295 CaseInsensitiveCompareASCII<char>()); 295 base::CaseInsensitiveCompareASCII<char>());
296 if (it == headers.end()) 296 if (it == headers.end())
297 return false; 297 return false;
298 298
299 // ensure match is prefixed by newline 299 // ensure match is prefixed by newline
300 if (it != headers.begin() && it[-1] != '\n') 300 if (it != headers.begin() && it[-1] != '\n')
301 return false; 301 return false;
302 302
303 // ensure match is suffixed by colon 303 // ensure match is suffixed by colon
304 if (it + name_len >= headers.end() || it[name_len] != ':') 304 if (it + name_len >= headers.end() || it[name_len] != ':')
305 return false; 305 return false;
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 value_is_quoted_ = true; 861 value_is_quoted_ = true;
862 // Do not store iterators into this. See declaration of unquoted_value_. 862 // Do not store iterators into this. See declaration of unquoted_value_.
863 unquoted_value_ = HttpUtil::Unquote(value_begin_, value_end_); 863 unquoted_value_ = HttpUtil::Unquote(value_begin_, value_end_);
864 } 864 }
865 } 865 }
866 866
867 return true; 867 return true;
868 } 868 }
869 869
870 } // namespace net 870 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_response_headers.cc ('k') | net/url_request/url_request_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698