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 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 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 } | 763 } |
764 } | 764 } |
765 | 765 |
766 return false; | 766 return false; |
767 } | 767 } |
768 | 768 |
769 void HttpResponseHeaders::AddHeader(std::string::const_iterator name_begin, | 769 void HttpResponseHeaders::AddHeader(std::string::const_iterator name_begin, |
770 std::string::const_iterator name_end, | 770 std::string::const_iterator name_end, |
771 std::string::const_iterator values_begin, | 771 std::string::const_iterator values_begin, |
772 std::string::const_iterator values_end) { | 772 std::string::const_iterator values_end) { |
| 773 UMA_HISTOGRAM_BOOLEAN("Net.HttpResponseHeaderValueValidInRFC7230", |
| 774 HttpUtil::IsValidHeaderValueRFC7230( |
| 775 base::StringPiece(values_begin, values_end))); |
| 776 |
773 // If the header can be coalesced, then we should split it up. | 777 // If the header can be coalesced, then we should split it up. |
774 if (values_begin == values_end || | 778 if (values_begin == values_end || |
775 HttpUtil::IsNonCoalescingHeader(name_begin, name_end)) { | 779 HttpUtil::IsNonCoalescingHeader(name_begin, name_end)) { |
776 AddToParsed(name_begin, name_end, values_begin, values_end); | 780 AddToParsed(name_begin, name_end, values_begin, values_end); |
777 } else { | 781 } else { |
778 HttpUtil::ValuesIterator it(values_begin, values_end, ','); | 782 HttpUtil::ValuesIterator it(values_begin, values_end, ','); |
779 while (it.GetNext()) { | 783 while (it.GetNext()) { |
780 AddToParsed(name_begin, name_end, it.value_begin(), it.value_end()); | 784 AddToParsed(name_begin, name_end, it.value_begin(), it.value_end()); |
781 // clobber these so that subsequent values are treated as continuations | 785 // clobber these so that subsequent values are treated as continuations |
782 name_begin = name_end = raw_headers_.end(); | 786 name_begin = name_end = raw_headers_.end(); |
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1433 return true; | 1437 return true; |
1434 } | 1438 } |
1435 | 1439 |
1436 bool HttpResponseHeaders::IsChunkEncoded() const { | 1440 bool HttpResponseHeaders::IsChunkEncoded() const { |
1437 // Ignore spurious chunked responses from HTTP/1.0 servers and proxies. | 1441 // Ignore spurious chunked responses from HTTP/1.0 servers and proxies. |
1438 return GetHttpVersion() >= HttpVersion(1, 1) && | 1442 return GetHttpVersion() >= HttpVersion(1, 1) && |
1439 HasHeaderValue("Transfer-Encoding", "chunked"); | 1443 HasHeaderValue("Transfer-Encoding", "chunked"); |
1440 } | 1444 } |
1441 | 1445 |
1442 } // namespace net | 1446 } // namespace net |
OLD | NEW |