Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(553)

Side by Side Diff: net/http/http_response_info.cc

Issue 7177001: net: serialize SSL connection status to disk cache. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 // This bit is set if the response was received via SPDY. 51 // This bit is set if the response was received via SPDY.
52 RESPONSE_INFO_WAS_SPDY = 1 << 13, 52 RESPONSE_INFO_WAS_SPDY = 1 << 13,
53 53
54 // This bit is set if the request has NPN negotiated. 54 // This bit is set if the request has NPN negotiated.
55 RESPONSE_INFO_WAS_NPN = 1 << 14, 55 RESPONSE_INFO_WAS_NPN = 1 << 14,
56 56
57 // This bit is set if the request was fetched via an explicit proxy. 57 // This bit is set if the request was fetched via an explicit proxy.
58 RESPONSE_INFO_WAS_PROXY = 1 << 15, 58 RESPONSE_INFO_WAS_PROXY = 1 << 15,
59 59
60 // This bit is set if the response info has an SSL connection status field.
61 // This contains the ciphersuite of used to fetch the resource.
wtc 2011/06/16 17:46:35 Nit: remove "of" Nit: the SSL connection status c
62 RESPONSE_INFO_HAS_SSL_CONNECTION_STATUS = 1 << 16,
63
60 // TODO(darin): Add other bits to indicate alternate request methods. 64 // TODO(darin): Add other bits to indicate alternate request methods.
61 // For now, we don't support storing those. 65 // For now, we don't support storing those.
62 }; 66 };
63 67
64 HttpResponseInfo::HttpResponseInfo() 68 HttpResponseInfo::HttpResponseInfo()
65 : was_cached(false), 69 : was_cached(false),
66 was_fetched_via_spdy(false), 70 was_fetched_via_spdy(false),
67 was_npn_negotiated(false), 71 was_npn_negotiated(false),
68 was_fetched_via_proxy(false) { 72 was_fetched_via_proxy(false) {
69 } 73 }
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 return false; 155 return false;
152 ssl_info.cert_status = cert_status; 156 ssl_info.cert_status = cert_status;
153 } 157 }
154 if (flags & RESPONSE_INFO_HAS_SECURITY_BITS) { 158 if (flags & RESPONSE_INFO_HAS_SECURITY_BITS) {
155 int security_bits; 159 int security_bits;
156 if (!pickle.ReadInt(&iter, &security_bits)) 160 if (!pickle.ReadInt(&iter, &security_bits))
157 return false; 161 return false;
158 ssl_info.security_bits = security_bits; 162 ssl_info.security_bits = security_bits;
159 } 163 }
160 164
165 if (flags & RESPONSE_INFO_HAS_SSL_CONNECTION_STATUS) {
166 int connection_status;
167 if (!pickle.ReadInt(&iter, &connection_status))
168 return false;
169 ssl_info.connection_status = connection_status;
170 }
171
161 // read vary-data 172 // read vary-data
162 if (flags & RESPONSE_INFO_HAS_VARY_DATA) { 173 if (flags & RESPONSE_INFO_HAS_VARY_DATA) {
163 if (!vary_data.InitFromPickle(pickle, &iter)) 174 if (!vary_data.InitFromPickle(pickle, &iter))
164 return false; 175 return false;
165 } 176 }
166 177
167 // Read socket_address. 178 // Read socket_address.
168 std::string socket_address_host; 179 std::string socket_address_host;
169 if (pickle.ReadString(&iter, &socket_address_host)) { 180 if (pickle.ReadString(&iter, &socket_address_host)) {
170 // If the host was written, we always expect the port to follow. 181 // If the host was written, we always expect the port to follow.
(...skipping 20 matching lines...) Expand all
191 202
192 void HttpResponseInfo::Persist(Pickle* pickle, 203 void HttpResponseInfo::Persist(Pickle* pickle,
193 bool skip_transient_headers, 204 bool skip_transient_headers,
194 bool response_truncated) const { 205 bool response_truncated) const {
195 int flags = RESPONSE_INFO_VERSION; 206 int flags = RESPONSE_INFO_VERSION;
196 if (ssl_info.is_valid()) { 207 if (ssl_info.is_valid()) {
197 flags |= RESPONSE_INFO_HAS_CERT; 208 flags |= RESPONSE_INFO_HAS_CERT;
198 flags |= RESPONSE_INFO_HAS_CERT_STATUS; 209 flags |= RESPONSE_INFO_HAS_CERT_STATUS;
199 if (ssl_info.security_bits != -1) 210 if (ssl_info.security_bits != -1)
200 flags |= RESPONSE_INFO_HAS_SECURITY_BITS; 211 flags |= RESPONSE_INFO_HAS_SECURITY_BITS;
201 // TODO(wtc): we should persist ssl_info.connection_status. 212 if (ssl_info.connection_status != 0)
wtc 2011/06/16 17:46:35 I'm sorry I knew about this bug but it fell throug
213 flags |= RESPONSE_INFO_HAS_SSL_CONNECTION_STATUS;
202 } 214 }
203 if (vary_data.is_valid()) 215 if (vary_data.is_valid())
204 flags |= RESPONSE_INFO_HAS_VARY_DATA; 216 flags |= RESPONSE_INFO_HAS_VARY_DATA;
205 if (response_truncated) 217 if (response_truncated)
206 flags |= RESPONSE_INFO_TRUNCATED; 218 flags |= RESPONSE_INFO_TRUNCATED;
207 if (was_fetched_via_spdy) 219 if (was_fetched_via_spdy)
208 flags |= RESPONSE_INFO_WAS_SPDY; 220 flags |= RESPONSE_INFO_WAS_SPDY;
209 if (was_npn_negotiated) 221 if (was_npn_negotiated)
210 flags |= RESPONSE_INFO_WAS_NPN; 222 flags |= RESPONSE_INFO_WAS_NPN;
211 if (was_fetched_via_proxy) 223 if (was_fetched_via_proxy)
(...skipping 15 matching lines...) Expand all
227 net::HttpResponseHeaders::PERSIST_SANS_RANGES; 239 net::HttpResponseHeaders::PERSIST_SANS_RANGES;
228 } 240 }
229 241
230 headers->Persist(pickle, persist_options); 242 headers->Persist(pickle, persist_options);
231 243
232 if (ssl_info.is_valid()) { 244 if (ssl_info.is_valid()) {
233 ssl_info.cert->Persist(pickle); 245 ssl_info.cert->Persist(pickle);
234 pickle->WriteInt(ssl_info.cert_status); 246 pickle->WriteInt(ssl_info.cert_status);
235 if (ssl_info.security_bits != -1) 247 if (ssl_info.security_bits != -1)
236 pickle->WriteInt(ssl_info.security_bits); 248 pickle->WriteInt(ssl_info.security_bits);
249 if (ssl_info.connection_status != 0)
250 pickle->WriteInt(ssl_info.connection_status);
237 } 251 }
238 252
239 if (vary_data.is_valid()) 253 if (vary_data.is_valid())
240 vary_data.Persist(pickle); 254 vary_data.Persist(pickle);
241 255
242 pickle->WriteString(socket_address.host()); 256 pickle->WriteString(socket_address.host());
243 pickle->WriteUInt16(socket_address.port()); 257 pickle->WriteUInt16(socket_address.port());
244 } 258 }
245 259
246 } // namespace net 260 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698