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

Side by Side Diff: net/http/http_stream_factory_impl_job.h

Issue 1074193003: Verify alternative server certificate validity for origin. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Re: #9. Created 5 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
« no previous file with comments | « net/http/http_stream_factory_impl.cc ('k') | net/http/http_stream_factory_impl_job.cc » ('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) 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 #ifndef NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_H_ 5 #ifndef NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_H_
6 #define NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_H_ 6 #define NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 STATE_NONE 133 STATE_NONE
134 }; 134 };
135 135
136 enum JobStatus { 136 enum JobStatus {
137 STATUS_RUNNING, 137 STATUS_RUNNING,
138 STATUS_FAILED, 138 STATUS_FAILED,
139 STATUS_BROKEN, 139 STATUS_BROKEN,
140 STATUS_SUCCEEDED 140 STATUS_SUCCEEDED
141 }; 141 };
142 142
143 // Wrapper class for SpdySessionPool methods to enforce certificate
144 // requirements for SpdySessions.
145 class ValidSpdySessionPool {
146 public:
147 ValidSpdySessionPool(SpdySessionPool* spdy_session_pool,
148 GURL& origin_url,
149 bool is_spdy_alternate);
150
151 // The following two methods return OK if a SpdySession was not found (in
152 // which case |spdy_session| is set to nullptr), or if one was found (in
153 // which case |spdy_session| is set to it) and it has an associated SSL
154 // certificate with is valid for |origin_url_|, or if this requirement does
155 // not apply because the Job is not a SPDY alternate job. They return the
156 // appropriate error code otherwise, in which case |spdy_session| should not
157 // be used.
Ryan Hamilton 2015/04/27 15:35:55 nit: This comment is confusing, I think because it
Bence 2015/04/28 14:42:21 Done.
158 int FindAvailableSession(const SpdySessionKey& key,
159 const BoundNetLog& net_log,
160 base::WeakPtr<SpdySession>* spdy_session);
161 int CreateAvailableSessionFromSocket(
162 const SpdySessionKey& key,
163 scoped_ptr<ClientSocketHandle> connection,
164 const BoundNetLog& net_log,
165 int certificate_error_code,
166 bool is_secure,
167 base::WeakPtr<SpdySession>* spdy_session);
168
169 private:
170 // Returns OK if |spdy_session| has an associated SSL certificate with is
171 // valid for |origin_url_|, or if this requirement does not apply because
172 // the Job is not a SPDY alternate job, or if |spdy_session| is null.
173 // Returns appropriate error code otherwise.
174 int CheckAlternativeServiceValidityForOrigin(
175 base::WeakPtr<SpdySession> spdy_session);
176
177 SpdySessionPool* const spdy_session_pool_;
178 const GURL origin_url_;
179 const bool is_spdy_alternate_;
180 };
181
143 void OnStreamReadyCallback(); 182 void OnStreamReadyCallback();
144 void OnWebSocketHandshakeStreamReadyCallback(); 183 void OnWebSocketHandshakeStreamReadyCallback();
145 // This callback function is called when a new SPDY session is created. 184 // This callback function is called when a new SPDY session is created.
146 void OnNewSpdySessionReadyCallback(); 185 void OnNewSpdySessionReadyCallback();
147 void OnStreamFailedCallback(int result); 186 void OnStreamFailedCallback(int result);
148 void OnCertificateErrorCallback(int result, const SSLInfo& ssl_info); 187 void OnCertificateErrorCallback(int result, const SSLInfo& ssl_info);
149 void OnNeedsProxyAuthCallback(const HttpResponseInfo& response_info, 188 void OnNeedsProxyAuthCallback(const HttpResponseInfo& response_info,
150 HttpAuthController* auth_controller); 189 HttpAuthController* auth_controller);
151 void OnNeedsClientAuthCallback(SSLCertRequestInfo* cert_info); 190 void OnNeedsClientAuthCallback(SSLCertRequestInfo* cert_info);
152 void OnHttpsProxyTunnelResponseCallback(const HttpResponseInfo& response_info, 191 void OnHttpsProxyTunnelResponseCallback(const HttpResponseInfo& response_info,
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 // True if we negotiated NPN. 359 // True if we negotiated NPN.
321 bool was_npn_negotiated_; 360 bool was_npn_negotiated_;
322 361
323 // Protocol negotiated with the server. 362 // Protocol negotiated with the server.
324 NextProto protocol_negotiated_; 363 NextProto protocol_negotiated_;
325 364
326 // 0 if we're not preconnecting. Otherwise, the number of streams to 365 // 0 if we're not preconnecting. Otherwise, the number of streams to
327 // preconnect. 366 // preconnect.
328 int num_streams_; 367 int num_streams_;
329 368
369 scoped_ptr<ValidSpdySessionPool> valid_spdy_session_pool_;
370
330 // Initialized when we create a new SpdySession. 371 // Initialized when we create a new SpdySession.
331 base::WeakPtr<SpdySession> new_spdy_session_; 372 base::WeakPtr<SpdySession> new_spdy_session_;
332 373
333 // Initialized when we have an existing SpdySession. 374 // Initialized when we have an existing SpdySession.
334 base::WeakPtr<SpdySession> existing_spdy_session_; 375 base::WeakPtr<SpdySession> existing_spdy_session_;
335 376
336 // Only used if |new_spdy_session_| is non-NULL. 377 // Only used if |new_spdy_session_| is non-NULL.
337 bool spdy_session_direct_; 378 bool spdy_session_direct_;
338 379
339 JobStatus job_status_; 380 JobStatus job_status_;
340 JobStatus other_job_status_; 381 JobStatus other_job_status_;
341 382
342 base::WeakPtrFactory<Job> ptr_factory_; 383 base::WeakPtrFactory<Job> ptr_factory_;
343 384
344 DISALLOW_COPY_AND_ASSIGN(Job); 385 DISALLOW_COPY_AND_ASSIGN(Job);
345 }; 386 };
346 387
347 } // namespace net 388 } // namespace net
348 389
349 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_H_ 390 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_H_
OLDNEW
« no previous file with comments | « net/http/http_stream_factory_impl.cc ('k') | net/http/http_stream_factory_impl_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698