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

Side by Side Diff: net/http/http_response_headers.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_auth_cache.cc ('k') | net/http/http_stream_factory.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 header parsing were borrowed from Firefox: 5 // The rules for header parsing were borrowed from Firefox:
6 // http://lxr.mozilla.org/seamonkey/source/netwerk/protocol/http/src/nsHttpRespo nseHead.cpp 6 // http://lxr.mozilla.org/seamonkey/source/netwerk/protocol/http/src/nsHttpRespo nseHead.cpp
7 // The rules for parsing content-types were also borrowed from Firefox: 7 // The rules for parsing content-types were also borrowed from Firefox:
8 // http://lxr.mozilla.org/mozilla/source/netwerk/base/src/nsURLHelper.cpp#834 8 // http://lxr.mozilla.org/mozilla/source/netwerk/base/src/nsURLHelper.cpp#834
9 9
10 #include "net/http/http_response_headers.h" 10 #include "net/http/http_response_headers.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 "x-webkit-" 95 "x-webkit-"
96 }; 96 };
97 97
98 bool ShouldUpdateHeader(const std::string::const_iterator& name_begin, 98 bool ShouldUpdateHeader(const std::string::const_iterator& name_begin,
99 const std::string::const_iterator& name_end) { 99 const std::string::const_iterator& name_end) {
100 for (size_t i = 0; i < arraysize(kNonUpdatedHeaders); ++i) { 100 for (size_t i = 0; i < arraysize(kNonUpdatedHeaders); ++i) {
101 if (base::LowerCaseEqualsASCII(name_begin, name_end, kNonUpdatedHeaders[i])) 101 if (base::LowerCaseEqualsASCII(name_begin, name_end, kNonUpdatedHeaders[i]))
102 return false; 102 return false;
103 } 103 }
104 for (size_t i = 0; i < arraysize(kNonUpdatedHeaderPrefixes); ++i) { 104 for (size_t i = 0; i < arraysize(kNonUpdatedHeaderPrefixes); ++i) {
105 if (StartsWithASCII(std::string(name_begin, name_end), 105 if (base::StartsWithASCII(std::string(name_begin, name_end),
106 kNonUpdatedHeaderPrefixes[i], false)) 106 kNonUpdatedHeaderPrefixes[i], false))
107 return false; 107 return false;
108 } 108 }
109 return true; 109 return true;
110 } 110 }
111 111
112 void CheckDoesNotHaveEmbededNulls(const std::string& str) { 112 void CheckDoesNotHaveEmbededNulls(const std::string& str) {
113 // Care needs to be taken when adding values to the raw headers string to 113 // Care needs to be taken when adding values to the raw headers string to
114 // make sure it does not contain embeded NULLs. Any embeded '\0' may be 114 // make sure it does not contain embeded NULLs. Any embeded '\0' may be
115 // understood as line terminators and change how header lines get tokenized. 115 // understood as line terminators and change how header lines get tokenized.
116 CHECK(str.find('\0') == std::string::npos); 116 CHECK(str.find('\0') == std::string::npos);
(...skipping 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after
1444 return true; 1444 return true;
1445 } 1445 }
1446 1446
1447 bool HttpResponseHeaders::IsChunkEncoded() const { 1447 bool HttpResponseHeaders::IsChunkEncoded() const {
1448 // Ignore spurious chunked responses from HTTP/1.0 servers and proxies. 1448 // Ignore spurious chunked responses from HTTP/1.0 servers and proxies.
1449 return GetHttpVersion() >= HttpVersion(1, 1) && 1449 return GetHttpVersion() >= HttpVersion(1, 1) &&
1450 HasHeaderValue("Transfer-Encoding", "chunked"); 1450 HasHeaderValue("Transfer-Encoding", "chunked");
1451 } 1451 }
1452 1452
1453 } // namespace net 1453 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_auth_cache.cc ('k') | net/http/http_stream_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698