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(const Pickle& pickle, | 159 HttpResponseHeaders::HttpResponseHeaders(PickleIterator* iter) |
160 PickleIterator* iter) | |
161 : response_code_(-1) { | 160 : response_code_(-1) { |
162 std::string raw_input; | 161 std::string raw_input; |
163 if (pickle.ReadString(iter, &raw_input)) | 162 if (iter->ReadString(&raw_input)) |
164 Parse(raw_input); | 163 Parse(raw_input); |
165 } | 164 } |
166 | 165 |
167 void HttpResponseHeaders::Persist(Pickle* pickle, PersistOptions options) { | 166 void HttpResponseHeaders::Persist(Pickle* pickle, PersistOptions options) { |
168 if (options == PERSIST_RAW) { | 167 if (options == PERSIST_RAW) { |
169 pickle->WriteString(raw_headers_); | 168 pickle->WriteString(raw_headers_); |
170 return; // Done. | 169 return; // Done. |
171 } | 170 } |
172 | 171 |
173 HeaderSet filter_headers; | 172 HeaderSet filter_headers; |
(...skipping 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1443 return true; | 1442 return true; |
1444 } | 1443 } |
1445 | 1444 |
1446 bool HttpResponseHeaders::IsChunkEncoded() const { | 1445 bool HttpResponseHeaders::IsChunkEncoded() const { |
1447 // Ignore spurious chunked responses from HTTP/1.0 servers and proxies. | 1446 // Ignore spurious chunked responses from HTTP/1.0 servers and proxies. |
1448 return GetHttpVersion() >= HttpVersion(1, 1) && | 1447 return GetHttpVersion() >= HttpVersion(1, 1) && |
1449 HasHeaderValue("Transfer-Encoding", "chunked"); | 1448 HasHeaderValue("Transfer-Encoding", "chunked"); |
1450 } | 1449 } |
1451 | 1450 |
1452 } // namespace net | 1451 } // namespace net |
OLD | NEW |