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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 // HttpResponseHeader that was serialized, and initialization of the | 162 // HttpResponseHeader that was serialized, and initialization of the |
163 // new object from that pickle. | 163 // new object from that pickle. |
164 UMA_HISTOGRAM_CUSTOM_ENUMERATION("Net.HttpResponseCode", | 164 UMA_HISTOGRAM_CUSTOM_ENUMERATION("Net.HttpResponseCode", |
165 MapHttpResponseCode(response_code_), | 165 MapHttpResponseCode(response_code_), |
166 // Note the third argument is only | 166 // Note the third argument is only |
167 // evaluated once, see macro | 167 // evaluated once, see macro |
168 // definition for details. | 168 // definition for details. |
169 GetAllHttpResponseCodes()); | 169 GetAllHttpResponseCodes()); |
170 } | 170 } |
171 | 171 |
172 HttpResponseHeaders::HttpResponseHeaders(const Pickle& pickle, void** iter) | 172 HttpResponseHeaders::HttpResponseHeaders(const Pickle& pickle, |
| 173 PickleIterator* iter) |
173 : response_code_(-1) { | 174 : response_code_(-1) { |
174 std::string raw_input; | 175 std::string raw_input; |
175 if (pickle.ReadString(iter, &raw_input)) | 176 if (pickle.ReadString(iter, &raw_input)) |
176 Parse(raw_input); | 177 Parse(raw_input); |
177 } | 178 } |
178 | 179 |
179 void HttpResponseHeaders::Persist(Pickle* pickle, PersistOptions options) { | 180 void HttpResponseHeaders::Persist(Pickle* pickle, PersistOptions options) { |
180 if (options == PERSIST_RAW) { | 181 if (options == PERSIST_RAW) { |
181 pickle->WriteString(raw_headers_); | 182 pickle->WriteString(raw_headers_); |
182 return; // Done. | 183 return; // Done. |
(...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1321 return true; | 1322 return true; |
1322 } | 1323 } |
1323 | 1324 |
1324 bool HttpResponseHeaders::IsChunkEncoded() const { | 1325 bool HttpResponseHeaders::IsChunkEncoded() const { |
1325 // Ignore spurious chunked responses from HTTP/1.0 servers and proxies. | 1326 // Ignore spurious chunked responses from HTTP/1.0 servers and proxies. |
1326 return GetHttpVersion() >= HttpVersion(1, 1) && | 1327 return GetHttpVersion() >= HttpVersion(1, 1) && |
1327 HasHeaderValue("Transfer-Encoding", "chunked"); | 1328 HasHeaderValue("Transfer-Encoding", "chunked"); |
1328 } | 1329 } |
1329 | 1330 |
1330 } // namespace net | 1331 } // namespace net |
OLD | NEW |