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

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

Issue 6804032: Add TLS-SRP (RFC 5054) support Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: remove "httpsv" scheme, minor NSS/OpenSSL changes Created 9 years, 8 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 | « net/http/http_response_info.h ('k') | net/http/http_stream.h » ('j') | 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) 2010 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"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 // This bit is set if the request has NPN negotiated. 49 // This bit is set if the request has NPN negotiated.
50 RESPONSE_INFO_WAS_NPN = 1 << 14, 50 RESPONSE_INFO_WAS_NPN = 1 << 14,
51 51
52 // This bit is set if the request was fetched via an explicit proxy. 52 // This bit is set if the request was fetched via an explicit proxy.
53 RESPONSE_INFO_WAS_PROXY = 1 << 15, 53 RESPONSE_INFO_WAS_PROXY = 1 << 15,
54 54
55 // This bit is set if response could use alternate protocol. However, browser 55 // This bit is set if response could use alternate protocol. However, browser
56 // will ingore the alternate protocol if spdy is not enabled. 56 // will ingore the alternate protocol if spdy is not enabled.
57 RESPONSE_INFO_WAS_ALTERNATE_PROTOCOL_AVAILABLE = 1 << 16, 57 RESPONSE_INFO_WAS_ALTERNATE_PROTOCOL_AVAILABLE = 1 << 16,
58 58
59 // This bit is set if the response info has a TLS username.
60 RESPONSE_INFO_HAS_TLS_USERNAME = 1 << 17,
61
59 // TODO(darin): Add other bits to indicate alternate request methods. 62 // TODO(darin): Add other bits to indicate alternate request methods.
60 // For now, we don't support storing those. 63 // For now, we don't support storing those.
61 }; 64 };
62 65
63 HttpResponseInfo::HttpResponseInfo() 66 HttpResponseInfo::HttpResponseInfo()
64 : was_cached(false), 67 : was_cached(false),
65 was_fetched_via_spdy(false), 68 was_fetched_via_spdy(false),
66 was_npn_negotiated(false), 69 was_npn_negotiated(false),
67 was_alternate_protocol_available(false), 70 was_alternate_protocol_available(false),
68 was_fetched_via_proxy(false) { 71 was_fetched_via_proxy(false) {
69 } 72 }
70 73
71 HttpResponseInfo::HttpResponseInfo(const HttpResponseInfo& rhs) 74 HttpResponseInfo::HttpResponseInfo(const HttpResponseInfo& rhs)
72 : was_cached(rhs.was_cached), 75 : was_cached(rhs.was_cached),
73 was_fetched_via_spdy(rhs.was_fetched_via_spdy), 76 was_fetched_via_spdy(rhs.was_fetched_via_spdy),
74 was_npn_negotiated(rhs.was_npn_negotiated), 77 was_npn_negotiated(rhs.was_npn_negotiated),
75 was_alternate_protocol_available(rhs.was_alternate_protocol_available), 78 was_alternate_protocol_available(rhs.was_alternate_protocol_available),
76 was_fetched_via_proxy(rhs.was_fetched_via_proxy), 79 was_fetched_via_proxy(rhs.was_fetched_via_proxy),
77 request_time(rhs.request_time), 80 request_time(rhs.request_time),
78 response_time(rhs.response_time), 81 response_time(rhs.response_time),
79 auth_challenge(rhs.auth_challenge), 82 auth_challenge(rhs.auth_challenge),
80 cert_request_info(rhs.cert_request_info), 83 cert_request_info(rhs.cert_request_info),
84 login_request_info(rhs.login_request_info),
81 ssl_info(rhs.ssl_info), 85 ssl_info(rhs.ssl_info),
82 headers(rhs.headers), 86 headers(rhs.headers),
83 vary_data(rhs.vary_data), 87 vary_data(rhs.vary_data),
84 metadata(rhs.metadata) { 88 metadata(rhs.metadata) {
85 } 89 }
86 90
87 HttpResponseInfo::~HttpResponseInfo() { 91 HttpResponseInfo::~HttpResponseInfo() {
88 } 92 }
89 93
90 HttpResponseInfo& HttpResponseInfo::operator=(const HttpResponseInfo& rhs) { 94 HttpResponseInfo& HttpResponseInfo::operator=(const HttpResponseInfo& rhs) {
91 was_cached = rhs.was_cached; 95 was_cached = rhs.was_cached;
92 was_fetched_via_spdy = rhs.was_fetched_via_spdy; 96 was_fetched_via_spdy = rhs.was_fetched_via_spdy;
93 was_npn_negotiated = rhs.was_npn_negotiated; 97 was_npn_negotiated = rhs.was_npn_negotiated;
94 was_alternate_protocol_available = rhs.was_alternate_protocol_available; 98 was_alternate_protocol_available = rhs.was_alternate_protocol_available;
95 was_fetched_via_proxy = rhs.was_fetched_via_proxy; 99 was_fetched_via_proxy = rhs.was_fetched_via_proxy;
96 request_time = rhs.request_time; 100 request_time = rhs.request_time;
97 response_time = rhs.response_time; 101 response_time = rhs.response_time;
98 auth_challenge = rhs.auth_challenge; 102 auth_challenge = rhs.auth_challenge;
99 cert_request_info = rhs.cert_request_info; 103 cert_request_info = rhs.cert_request_info;
104 login_request_info = rhs.login_request_info;
100 ssl_info = rhs.ssl_info; 105 ssl_info = rhs.ssl_info;
101 headers = rhs.headers; 106 headers = rhs.headers;
102 vary_data = rhs.vary_data; 107 vary_data = rhs.vary_data;
103 metadata = rhs.metadata; 108 metadata = rhs.metadata;
104 return *this; 109 return *this;
105 } 110 }
106 111
107 bool HttpResponseInfo::InitFromPickle(const Pickle& pickle, 112 bool HttpResponseInfo::InitFromPickle(const Pickle& pickle,
108 bool* response_truncated) { 113 bool* response_truncated) {
109 void* iter = NULL; 114 void* iter = NULL;
(...skipping 22 matching lines...) Expand all
132 137
133 // read response-headers 138 // read response-headers
134 headers = new HttpResponseHeaders(pickle, &iter); 139 headers = new HttpResponseHeaders(pickle, &iter);
135 DCHECK_NE(headers->response_code(), -1); 140 DCHECK_NE(headers->response_code(), -1);
136 141
137 // read ssl-info 142 // read ssl-info
138 if (flags & RESPONSE_INFO_HAS_CERT) { 143 if (flags & RESPONSE_INFO_HAS_CERT) {
139 ssl_info.cert = 144 ssl_info.cert =
140 X509Certificate::CreateFromPickle(pickle, &iter); 145 X509Certificate::CreateFromPickle(pickle, &iter);
141 } 146 }
147 if (flags & RESPONSE_INFO_HAS_TLS_USERNAME) {
148 string16 tls_username;
149 if (!pickle.ReadString16(&iter, &tls_username))
150 return false;
151 ssl_info.tls_username = tls_username;
152 }
142 if (flags & RESPONSE_INFO_HAS_CERT_STATUS) { 153 if (flags & RESPONSE_INFO_HAS_CERT_STATUS) {
143 int cert_status; 154 int cert_status;
144 if (!pickle.ReadInt(&iter, &cert_status)) 155 if (!pickle.ReadInt(&iter, &cert_status))
145 return false; 156 return false;
146 ssl_info.cert_status = cert_status; 157 ssl_info.cert_status = cert_status;
147 } 158 }
148 if (flags & RESPONSE_INFO_HAS_SECURITY_BITS) { 159 if (flags & RESPONSE_INFO_HAS_SECURITY_BITS) {
149 int security_bits; 160 int security_bits;
150 if (!pickle.ReadInt(&iter, &security_bits)) 161 if (!pickle.ReadInt(&iter, &security_bits))
151 return false; 162 return false;
(...skipping 18 matching lines...) Expand all
170 *response_truncated = (flags & RESPONSE_INFO_TRUNCATED) ? true : false; 181 *response_truncated = (flags & RESPONSE_INFO_TRUNCATED) ? true : false;
171 182
172 return true; 183 return true;
173 } 184 }
174 185
175 void HttpResponseInfo::Persist(Pickle* pickle, 186 void HttpResponseInfo::Persist(Pickle* pickle,
176 bool skip_transient_headers, 187 bool skip_transient_headers,
177 bool response_truncated) const { 188 bool response_truncated) const {
178 int flags = RESPONSE_INFO_VERSION; 189 int flags = RESPONSE_INFO_VERSION;
179 if (ssl_info.is_valid()) { 190 if (ssl_info.is_valid()) {
180 flags |= RESPONSE_INFO_HAS_CERT; 191 if (ssl_info.cert.get())
192 flags |= RESPONSE_INFO_HAS_CERT;
193 if (!ssl_info.tls_username.empty())
194 flags |= RESPONSE_INFO_HAS_TLS_USERNAME;
181 flags |= RESPONSE_INFO_HAS_CERT_STATUS; 195 flags |= RESPONSE_INFO_HAS_CERT_STATUS;
182 if (ssl_info.security_bits != -1) 196 if (ssl_info.security_bits != -1)
183 flags |= RESPONSE_INFO_HAS_SECURITY_BITS; 197 flags |= RESPONSE_INFO_HAS_SECURITY_BITS;
184 // TODO(wtc): we should persist ssl_info.connection_status. 198 // TODO(wtc): we should persist ssl_info.connection_status.
185 } 199 }
186 if (vary_data.is_valid()) 200 if (vary_data.is_valid())
187 flags |= RESPONSE_INFO_HAS_VARY_DATA; 201 flags |= RESPONSE_INFO_HAS_VARY_DATA;
188 if (response_truncated) 202 if (response_truncated)
189 flags |= RESPONSE_INFO_TRUNCATED; 203 flags |= RESPONSE_INFO_TRUNCATED;
190 if (was_fetched_via_spdy) 204 if (was_fetched_via_spdy)
(...skipping 17 matching lines...) Expand all
208 net::HttpResponseHeaders::PERSIST_SANS_COOKIES | 222 net::HttpResponseHeaders::PERSIST_SANS_COOKIES |
209 net::HttpResponseHeaders::PERSIST_SANS_CHALLENGES | 223 net::HttpResponseHeaders::PERSIST_SANS_CHALLENGES |
210 net::HttpResponseHeaders::PERSIST_SANS_HOP_BY_HOP | 224 net::HttpResponseHeaders::PERSIST_SANS_HOP_BY_HOP |
211 net::HttpResponseHeaders::PERSIST_SANS_NON_CACHEABLE | 225 net::HttpResponseHeaders::PERSIST_SANS_NON_CACHEABLE |
212 net::HttpResponseHeaders::PERSIST_SANS_RANGES; 226 net::HttpResponseHeaders::PERSIST_SANS_RANGES;
213 } 227 }
214 228
215 headers->Persist(pickle, persist_options); 229 headers->Persist(pickle, persist_options);
216 230
217 if (ssl_info.is_valid()) { 231 if (ssl_info.is_valid()) {
218 ssl_info.cert->Persist(pickle); 232 if (flags & RESPONSE_INFO_HAS_CERT)
233 ssl_info.cert->Persist(pickle);
234 if (flags & RESPONSE_INFO_HAS_TLS_USERNAME)
235 pickle->WriteString16(ssl_info.tls_username);
219 pickle->WriteInt(ssl_info.cert_status); 236 pickle->WriteInt(ssl_info.cert_status);
220 if (ssl_info.security_bits != -1) 237 if (ssl_info.security_bits != -1)
221 pickle->WriteInt(ssl_info.security_bits); 238 pickle->WriteInt(ssl_info.security_bits);
222 } 239 }
223 240
224 if (vary_data.is_valid()) 241 if (vary_data.is_valid())
225 vary_data.Persist(pickle); 242 vary_data.Persist(pickle);
226 } 243 }
227 244
228 } // namespace net 245 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_response_info.h ('k') | net/http/http_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698