| 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 // new object from that pickle. | 149 // new object from that pickle. |
| 150 UMA_HISTOGRAM_CUSTOM_ENUMERATION("Net.HttpResponseCode", | 150 UMA_HISTOGRAM_CUSTOM_ENUMERATION("Net.HttpResponseCode", |
| 151 HttpUtil::MapStatusCodeForHistogram( | 151 HttpUtil::MapStatusCodeForHistogram( |
| 152 response_code_), | 152 response_code_), |
| 153 // Note the third argument is only | 153 // Note the third argument is only |
| 154 // evaluated once, see macro | 154 // evaluated once, see macro |
| 155 // definition for details. | 155 // definition for details. |
| 156 HttpUtil::GetStatusCodesForHistogram()); | 156 HttpUtil::GetStatusCodesForHistogram()); |
| 157 } | 157 } |
| 158 | 158 |
| 159 HttpResponseHeaders::HttpResponseHeaders(PickleIterator* iter) | 159 HttpResponseHeaders::HttpResponseHeaders(const Pickle& pickle, |
| 160 PickleIterator* iter) |
| 160 : response_code_(-1) { | 161 : response_code_(-1) { |
| 161 std::string raw_input; | 162 std::string raw_input; |
| 162 if (iter->ReadString(&raw_input)) | 163 if (pickle.ReadString(iter, &raw_input)) |
| 163 Parse(raw_input); | 164 Parse(raw_input); |
| 164 } | 165 } |
| 165 | 166 |
| 166 void HttpResponseHeaders::Persist(Pickle* pickle, PersistOptions options) { | 167 void HttpResponseHeaders::Persist(Pickle* pickle, PersistOptions options) { |
| 167 if (options == PERSIST_RAW) { | 168 if (options == PERSIST_RAW) { |
| 168 pickle->WriteString(raw_headers_); | 169 pickle->WriteString(raw_headers_); |
| 169 return; // Done. | 170 return; // Done. |
| 170 } | 171 } |
| 171 | 172 |
| 172 HeaderSet filter_headers; | 173 HeaderSet filter_headers; |
| (...skipping 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1442 return true; | 1443 return true; |
| 1443 } | 1444 } |
| 1444 | 1445 |
| 1445 bool HttpResponseHeaders::IsChunkEncoded() const { | 1446 bool HttpResponseHeaders::IsChunkEncoded() const { |
| 1446 // Ignore spurious chunked responses from HTTP/1.0 servers and proxies. | 1447 // Ignore spurious chunked responses from HTTP/1.0 servers and proxies. |
| 1447 return GetHttpVersion() >= HttpVersion(1, 1) && | 1448 return GetHttpVersion() >= HttpVersion(1, 1) && |
| 1448 HasHeaderValue("Transfer-Encoding", "chunked"); | 1449 HasHeaderValue("Transfer-Encoding", "chunked"); |
| 1449 } | 1450 } |
| 1450 | 1451 |
| 1451 } // namespace net | 1452 } // namespace net |
| OLD | NEW |