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

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

Issue 2555813002: Don't consider '\0' as whitespace when parsing HTTP headers. (Closed)
Patch Set: Created 4 years 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 | « no previous file | net/http/http_util_unittest.cc » ('j') | net/http/http_util_unittest.cc » ('J')
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 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 for (const char* header : kNonCoalescingHeaders) { 419 for (const char* header : kNonCoalescingHeaders) {
420 if (base::LowerCaseEqualsASCII(base::StringPiece(name_begin, name_end), 420 if (base::LowerCaseEqualsASCII(base::StringPiece(name_begin, name_end),
421 header)) { 421 header)) {
422 return true; 422 return true;
423 } 423 }
424 } 424 }
425 return false; 425 return false;
426 } 426 }
427 427
428 bool HttpUtil::IsLWS(char c) { 428 bool HttpUtil::IsLWS(char c) {
429 return strchr(HTTP_LWS, c) != NULL; 429 base::StringPiece kLws(HTTP_LWS);
mmenke 2016/12/06 19:08:24 Needs a const. Also, LWS is one thing, but kLws s
eroman 2016/12/06 19:19:34 Done.
430 return kLws.find(c) != base::StringPiece::npos;
430 } 431 }
431 432
432 // static 433 // static
433 void HttpUtil::TrimLWS(std::string::const_iterator* begin, 434 void HttpUtil::TrimLWS(std::string::const_iterator* begin,
434 std::string::const_iterator* end) { 435 std::string::const_iterator* end) {
435 TrimLWSImplementation(begin, end); 436 TrimLWSImplementation(begin, end);
436 } 437 }
437 438
438 // static 439 // static
439 base::StringPiece HttpUtil::TrimLWS(const base::StringPiece& string) { 440 base::StringPiece HttpUtil::TrimLWS(const base::StringPiece& string) {
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
1073 return true; 1074 return true;
1074 } 1075 }
1075 1076
1076 bool HttpUtil::NameValuePairsIterator::IsQuote(char c) const { 1077 bool HttpUtil::NameValuePairsIterator::IsQuote(char c) const {
1077 if (strict_quotes_) 1078 if (strict_quotes_)
1078 return c == '"'; 1079 return c == '"';
1079 return HttpUtil::IsQuote(c); 1080 return HttpUtil::IsQuote(c);
1080 } 1081 }
1081 1082
1082 } // namespace net 1083 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/http/http_util_unittest.cc » ('j') | net/http/http_util_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698