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(base::PickleIterator* iter) |
160 : response_code_(-1) { | 160 : response_code_(-1) { |
161 std::string raw_input; | 161 std::string raw_input; |
162 if (iter->ReadString(&raw_input)) | 162 if (iter->ReadString(&raw_input)) |
163 Parse(raw_input); | 163 Parse(raw_input); |
164 } | 164 } |
165 | 165 |
166 void HttpResponseHeaders::Persist(Pickle* pickle, PersistOptions options) { | 166 void HttpResponseHeaders::Persist(base::Pickle* pickle, |
| 167 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; |
173 | 174 |
174 // Construct set of headers to filter out based on options. | 175 // Construct set of headers to filter out based on options. |
175 if ((options & PERSIST_SANS_NON_CACHEABLE) == PERSIST_SANS_NON_CACHEABLE) | 176 if ((options & PERSIST_SANS_NON_CACHEABLE) == PERSIST_SANS_NON_CACHEABLE) |
176 AddNonCacheableHeaders(&filter_headers); | 177 AddNonCacheableHeaders(&filter_headers); |
(...skipping 1267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1444 return true; | 1445 return true; |
1445 } | 1446 } |
1446 | 1447 |
1447 bool HttpResponseHeaders::IsChunkEncoded() const { | 1448 bool HttpResponseHeaders::IsChunkEncoded() const { |
1448 // Ignore spurious chunked responses from HTTP/1.0 servers and proxies. | 1449 // Ignore spurious chunked responses from HTTP/1.0 servers and proxies. |
1449 return GetHttpVersion() >= HttpVersion(1, 1) && | 1450 return GetHttpVersion() >= HttpVersion(1, 1) && |
1450 HasHeaderValue("Transfer-Encoding", "chunked"); | 1451 HasHeaderValue("Transfer-Encoding", "chunked"); |
1451 } | 1452 } |
1452 | 1453 |
1453 } // namespace net | 1454 } // namespace net |
OLD | NEW |