OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "net/http/http_response_info.h" | 5 #include "net/http/http_response_info.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/pickle.h" | 8 #include "base/pickle.h" |
9 #include "base/time.h" | 9 #include "base/time.h" |
10 #include "net/base/auth.h" | 10 #include "net/base/auth.h" |
11 #include "net/base/io_buffer.h" | 11 #include "net/base/io_buffer.h" |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 | 169 |
170 *response_truncated = (flags & RESPONSE_INFO_TRUNCATED) ? true : false; | 170 *response_truncated = (flags & RESPONSE_INFO_TRUNCATED) ? true : false; |
171 | 171 |
172 return true; | 172 return true; |
173 } | 173 } |
174 | 174 |
175 void HttpResponseInfo::Persist(Pickle* pickle, | 175 void HttpResponseInfo::Persist(Pickle* pickle, |
176 bool skip_transient_headers, | 176 bool skip_transient_headers, |
177 bool response_truncated) const { | 177 bool response_truncated) const { |
178 int flags = RESPONSE_INFO_VERSION; | 178 int flags = RESPONSE_INFO_VERSION; |
179 if (ssl_info.cert) { | 179 if (ssl_info.is_valid()) { |
180 flags |= RESPONSE_INFO_HAS_CERT; | 180 flags |= RESPONSE_INFO_HAS_CERT; |
181 flags |= RESPONSE_INFO_HAS_CERT_STATUS; | 181 flags |= RESPONSE_INFO_HAS_CERT_STATUS; |
| 182 if (ssl_info.security_bits != -1) |
| 183 flags |= RESPONSE_INFO_HAS_SECURITY_BITS; |
| 184 // TODO(wtc): we should persist ssl_info.connection_status. |
182 } | 185 } |
183 if (ssl_info.security_bits != -1) | |
184 flags |= RESPONSE_INFO_HAS_SECURITY_BITS; | |
185 // TODO(wtc): we should persist ssl_info.connection_status. | |
186 if (vary_data.is_valid()) | 186 if (vary_data.is_valid()) |
187 flags |= RESPONSE_INFO_HAS_VARY_DATA; | 187 flags |= RESPONSE_INFO_HAS_VARY_DATA; |
188 if (response_truncated) | 188 if (response_truncated) |
189 flags |= RESPONSE_INFO_TRUNCATED; | 189 flags |= RESPONSE_INFO_TRUNCATED; |
190 if (was_fetched_via_spdy) | 190 if (was_fetched_via_spdy) |
191 flags |= RESPONSE_INFO_WAS_SPDY; | 191 flags |= RESPONSE_INFO_WAS_SPDY; |
192 if (was_npn_negotiated) | 192 if (was_npn_negotiated) |
193 flags |= RESPONSE_INFO_WAS_NPN; | 193 flags |= RESPONSE_INFO_WAS_NPN; |
194 if (was_alternate_protocol_available) | 194 if (was_alternate_protocol_available) |
195 flags |= RESPONSE_INFO_WAS_ALTERNATE_PROTOCOL_AVAILABLE; | 195 flags |= RESPONSE_INFO_WAS_ALTERNATE_PROTOCOL_AVAILABLE; |
(...skipping 11 matching lines...) Expand all Loading... |
207 persist_options = | 207 persist_options = |
208 net::HttpResponseHeaders::PERSIST_SANS_COOKIES | | 208 net::HttpResponseHeaders::PERSIST_SANS_COOKIES | |
209 net::HttpResponseHeaders::PERSIST_SANS_CHALLENGES | | 209 net::HttpResponseHeaders::PERSIST_SANS_CHALLENGES | |
210 net::HttpResponseHeaders::PERSIST_SANS_HOP_BY_HOP | | 210 net::HttpResponseHeaders::PERSIST_SANS_HOP_BY_HOP | |
211 net::HttpResponseHeaders::PERSIST_SANS_NON_CACHEABLE | | 211 net::HttpResponseHeaders::PERSIST_SANS_NON_CACHEABLE | |
212 net::HttpResponseHeaders::PERSIST_SANS_RANGES; | 212 net::HttpResponseHeaders::PERSIST_SANS_RANGES; |
213 } | 213 } |
214 | 214 |
215 headers->Persist(pickle, persist_options); | 215 headers->Persist(pickle, persist_options); |
216 | 216 |
217 if (ssl_info.cert) { | 217 if (ssl_info.is_valid()) { |
218 ssl_info.cert->Persist(pickle); | 218 ssl_info.cert->Persist(pickle); |
219 pickle->WriteInt(ssl_info.cert_status); | 219 pickle->WriteInt(ssl_info.cert_status); |
| 220 if (ssl_info.security_bits != -1) |
| 221 pickle->WriteInt(ssl_info.security_bits); |
220 } | 222 } |
221 if (ssl_info.security_bits != -1) | |
222 pickle->WriteInt(ssl_info.security_bits); | |
223 | 223 |
224 if (vary_data.is_valid()) | 224 if (vary_data.is_valid()) |
225 vary_data.Persist(pickle); | 225 vary_data.Persist(pickle); |
226 } | 226 } |
227 | 227 |
228 } // namespace net | 228 } // namespace net |
OLD | NEW |