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

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: comments #7. 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
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 to guarantee certificate requirements for
144 // SpdySessions.
145 class ValidSpdySessionPool {
146 public:
147 ValidSpdySessionPool(SpdySessionPool* spdy_session_pool,
148 GURL& origin_url,
149 bool is_spdy_alternate);
150
151 int FindAvailableSession(const SpdySessionKey& key,
152 const BoundNetLog& net_log,
153 base::WeakPtr<SpdySession>* spdy_session);
154
155 int CreateAvailableSessionFromSocket(
156 const SpdySessionKey& key,
157 scoped_ptr<ClientSocketHandle> connection,
158 const BoundNetLog& net_log,
159 int certificate_error_code,
160 bool is_secure,
161 base::WeakPtr<SpdySession>* spdy_session);
162
163 private:
164 // Returns OK if |spdy_session| has an associated SSL certificate with is
165 // valid for |origin_url_|, or if this requirement does not apply because
166 // the Job is not a SPDY alternate job, or |spdy_session| is null. Returns
167 // appropriate error code otherwise.
168 int CheckAlternativeServiceValidityForOrigin(
169 base::WeakPtr<SpdySession> spdy_session);
170
171 SpdySessionPool* const spdy_session_pool_;
172 const GURL origin_url_;
173 const bool is_spdy_alternate_;
174 };
175
143 void OnStreamReadyCallback(); 176 void OnStreamReadyCallback();
144 void OnWebSocketHandshakeStreamReadyCallback(); 177 void OnWebSocketHandshakeStreamReadyCallback();
145 // This callback function is called when a new SPDY session is created. 178 // This callback function is called when a new SPDY session is created.
146 void OnNewSpdySessionReadyCallback(); 179 void OnNewSpdySessionReadyCallback();
147 void OnStreamFailedCallback(int result); 180 void OnStreamFailedCallback(int result);
148 void OnCertificateErrorCallback(int result, const SSLInfo& ssl_info); 181 void OnCertificateErrorCallback(int result, const SSLInfo& ssl_info);
149 void OnNeedsProxyAuthCallback(const HttpResponseInfo& response_info, 182 void OnNeedsProxyAuthCallback(const HttpResponseInfo& response_info,
150 HttpAuthController* auth_controller); 183 HttpAuthController* auth_controller);
151 void OnNeedsClientAuthCallback(SSLCertRequestInfo* cert_info); 184 void OnNeedsClientAuthCallback(SSLCertRequestInfo* cert_info);
152 void OnHttpsProxyTunnelResponseCallback(const HttpResponseInfo& response_info, 185 void OnHttpsProxyTunnelResponseCallback(const HttpResponseInfo& response_info,
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 // True if we negotiated NPN. 353 // True if we negotiated NPN.
321 bool was_npn_negotiated_; 354 bool was_npn_negotiated_;
322 355
323 // Protocol negotiated with the server. 356 // Protocol negotiated with the server.
324 NextProto protocol_negotiated_; 357 NextProto protocol_negotiated_;
325 358
326 // 0 if we're not preconnecting. Otherwise, the number of streams to 359 // 0 if we're not preconnecting. Otherwise, the number of streams to
327 // preconnect. 360 // preconnect.
328 int num_streams_; 361 int num_streams_;
329 362
363 // Wrapper class for SpdySessionPool to enforce certificate requirements.
364 scoped_ptr<ValidSpdySessionPool> valid_spdy_session_pool_;
365
330 // Initialized when we create a new SpdySession. 366 // Initialized when we create a new SpdySession.
331 base::WeakPtr<SpdySession> new_spdy_session_; 367 base::WeakPtr<SpdySession> new_spdy_session_;
332 368
333 // Initialized when we have an existing SpdySession. 369 // Initialized when we have an existing SpdySession.
334 base::WeakPtr<SpdySession> existing_spdy_session_; 370 base::WeakPtr<SpdySession> existing_spdy_session_;
335 371
336 // Only used if |new_spdy_session_| is non-NULL. 372 // Only used if |new_spdy_session_| is non-NULL.
337 bool spdy_session_direct_; 373 bool spdy_session_direct_;
338 374
339 JobStatus job_status_; 375 JobStatus job_status_;
340 JobStatus other_job_status_; 376 JobStatus other_job_status_;
341 377
342 base::WeakPtrFactory<Job> ptr_factory_; 378 base::WeakPtrFactory<Job> ptr_factory_;
343 379
344 DISALLOW_COPY_AND_ASSIGN(Job); 380 DISALLOW_COPY_AND_ASSIGN(Job);
345 }; 381 };
346 382
347 } // namespace net 383 } // namespace net
348 384
349 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_H_ 385 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698