OLD | NEW |
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" |
11 #include "net/base/completion_callback.h" | 11 #include "net/base/completion_callback.h" |
12 #include "net/base/net_log.h" | 12 #include "net/base/net_log.h" |
13 #include "net/base/ssl_config_service.h" | 13 #include "net/base/ssl_config_service.h" |
14 #include "net/http/http_auth.h" | 14 #include "net/http/http_auth.h" |
15 #include "net/http/http_auth_controller.h" | 15 #include "net/http/http_auth_controller.h" |
16 #include "net/http/http_proxy_client_socket_pool.h" | |
17 #include "net/http/http_request_info.h" | 16 #include "net/http/http_request_info.h" |
18 #include "net/http/http_stream_factory_impl.h" | 17 #include "net/http/http_stream_factory_impl.h" |
19 #include "net/proxy/proxy_service.h" | 18 #include "net/proxy/proxy_service.h" |
20 #include "net/socket/client_socket_handle.h" | 19 #include "net/socket/client_socket_handle.h" |
21 #include "net/socket/ssl_client_socket.h" | 20 #include "net/socket/ssl_client_socket.h" |
22 | 21 |
23 namespace net { | 22 namespace net { |
24 | 23 |
25 class ClientSocketHandle; | 24 class ClientSocketHandle; |
26 class HttpAuthController; | 25 class HttpAuthController; |
(...skipping 13 matching lines...) Expand all Loading... |
40 ~Job(); | 39 ~Job(); |
41 | 40 |
42 // Start initiates the process of creating a new HttpStream. |request| will be | 41 // Start initiates the process of creating a new HttpStream. |request| will be |
43 // notified upon completion if the Job has not been Orphan()'d. | 42 // notified upon completion if the Job has not been Orphan()'d. |
44 void Start(Request* request); | 43 void Start(Request* request); |
45 | 44 |
46 // Preconnect will attempt to request |num_streams| sockets from the | 45 // Preconnect will attempt to request |num_streams| sockets from the |
47 // appropriate ClientSocketPool. | 46 // appropriate ClientSocketPool. |
48 int Preconnect(int num_streams); | 47 int Preconnect(int num_streams); |
49 | 48 |
50 int RestartTunnelWithProxyAuth(); | 49 int RestartTunnelWithProxyAuth(const AuthCredentials& credentials); |
51 | |
52 LoadState GetLoadState() const; | 50 LoadState GetLoadState() const; |
53 | 51 |
54 // Marks this Job as the "alternate" job, from Alternate-Protocol. Tracks the | 52 // Marks this Job as the "alternate" job, from Alternate-Protocol. Tracks the |
55 // original url so we can mark the Alternate-Protocol as broken if | 53 // original url so we can mark the Alternate-Protocol as broken if |
56 // we fail to connect. | 54 // we fail to connect. |
57 void MarkAsAlternate(const GURL& original_url); | 55 void MarkAsAlternate(const GURL& original_url); |
58 | 56 |
59 // Tells |this| to wait for |job| to resume it. | 57 // Tells |this| to wait for |job| to resume it. |
60 void WaitFor(Job* job); | 58 void WaitFor(Job* job); |
61 | 59 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 STATE_DONE, | 116 STATE_DONE, |
119 STATE_NONE | 117 STATE_NONE |
120 }; | 118 }; |
121 | 119 |
122 void OnStreamReadyCallback(); | 120 void OnStreamReadyCallback(); |
123 void OnSpdySessionReadyCallback(); | 121 void OnSpdySessionReadyCallback(); |
124 void OnStreamFailedCallback(int result); | 122 void OnStreamFailedCallback(int result); |
125 void OnCertificateErrorCallback(int result, const SSLInfo& ssl_info); | 123 void OnCertificateErrorCallback(int result, const SSLInfo& ssl_info); |
126 void OnNeedsProxyAuthCallback(const HttpResponseInfo& response_info, | 124 void OnNeedsProxyAuthCallback(const HttpResponseInfo& response_info, |
127 HttpAuthController* auth_controller); | 125 HttpAuthController* auth_controller); |
128 void OnNeedsProxyTunnelAuthCallback(const HttpResponseInfo& response_info, | |
129 HttpAuthController* auth_controller, | |
130 CompletionCallback callback); | |
131 void OnNeedsClientAuthCallback(SSLCertRequestInfo* cert_info); | 126 void OnNeedsClientAuthCallback(SSLCertRequestInfo* cert_info); |
132 void OnHttpsProxyTunnelResponseCallback(const HttpResponseInfo& response_info, | 127 void OnHttpsProxyTunnelResponseCallback(const HttpResponseInfo& response_info, |
133 HttpStream* stream); | 128 HttpStream* stream); |
134 void OnPreconnectsComplete(); | 129 void OnPreconnectsComplete(); |
135 | 130 |
136 void OnIOComplete(int result); | 131 void OnIOComplete(int result); |
137 int RunLoop(int result); | 132 int RunLoop(int result); |
138 int DoLoop(int result); | 133 int DoLoop(int result); |
139 int StartInternal(); | 134 int StartInternal(); |
140 | 135 |
(...skipping 10 matching lines...) Expand all Loading... |
151 int DoInitConnectionComplete(int result); | 146 int DoInitConnectionComplete(int result); |
152 int DoWaitingUserAction(int result); | 147 int DoWaitingUserAction(int result); |
153 int DoCreateStream(); | 148 int DoCreateStream(); |
154 int DoCreateStreamComplete(int result); | 149 int DoCreateStreamComplete(int result); |
155 int DoRestartTunnelAuth(); | 150 int DoRestartTunnelAuth(); |
156 int DoRestartTunnelAuthComplete(int result); | 151 int DoRestartTunnelAuthComplete(int result); |
157 | 152 |
158 // Returns to STATE_INIT_CONNECTION and resets some state. | 153 // Returns to STATE_INIT_CONNECTION and resets some state. |
159 void ReturnToStateInitConnection(bool close_connection); | 154 void ReturnToStateInitConnection(bool close_connection); |
160 | 155 |
161 void DoRestartTunnelWithProxyAuth(); | |
162 | |
163 // Set the motivation for this request onto the underlying socket. | 156 // Set the motivation for this request onto the underlying socket. |
164 void SetSocketMotivation(); | 157 void SetSocketMotivation(); |
165 | 158 |
166 bool IsHttpsProxyAndHttpUrl(); | 159 bool IsHttpsProxyAndHttpUrl(); |
167 | 160 |
168 // Sets several fields of ssl_config for the given origin_server based on the | 161 // Sets several fields of ssl_config for the given origin_server based on the |
169 // proxy info and other factors. | 162 // proxy info and other factors. |
170 void InitSSLConfig(const HostPortPair& origin_server, | 163 void InitSSLConfig(const HostPortPair& origin_server, |
171 SSLConfig* ssl_config) const; | 164 SSLConfig* ssl_config) const; |
172 | 165 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 | 248 |
256 // Force spdy only for SSL connections. | 249 // Force spdy only for SSL connections. |
257 bool force_spdy_over_ssl_; | 250 bool force_spdy_over_ssl_; |
258 | 251 |
259 // The certificate error while using SPDY over SSL for insecure URLs. | 252 // The certificate error while using SPDY over SSL for insecure URLs. |
260 int spdy_certificate_error_; | 253 int spdy_certificate_error_; |
261 | 254 |
262 scoped_refptr<HttpAuthController> | 255 scoped_refptr<HttpAuthController> |
263 auth_controllers_[HttpAuth::AUTH_NUM_TARGETS]; | 256 auth_controllers_[HttpAuth::AUTH_NUM_TARGETS]; |
264 | 257 |
265 // Invoked after a request for tunnel auth has been handled. | |
266 CompletionCallback tunnel_auth_handled_callback_; | |
267 | |
268 // True when the tunnel is in the process of being established - we can't | 258 // True when the tunnel is in the process of being established - we can't |
269 // read from the socket until the tunnel is done. | 259 // read from the socket until the tunnel is done. |
270 bool establishing_tunnel_; | 260 bool establishing_tunnel_; |
271 | 261 |
272 scoped_ptr<HttpStream> stream_; | 262 scoped_ptr<HttpStream> stream_; |
273 | 263 |
274 // True if we negotiated NPN. | 264 // True if we negotiated NPN. |
275 bool was_npn_negotiated_; | 265 bool was_npn_negotiated_; |
276 | 266 |
277 // Protocol negotiated with the server. | 267 // Protocol negotiated with the server. |
(...skipping 16 matching lines...) Expand all Loading... |
294 bool existing_available_pipeline_; | 284 bool existing_available_pipeline_; |
295 | 285 |
296 base::WeakPtrFactory<Job> ptr_factory_; | 286 base::WeakPtrFactory<Job> ptr_factory_; |
297 | 287 |
298 DISALLOW_COPY_AND_ASSIGN(Job); | 288 DISALLOW_COPY_AND_ASSIGN(Job); |
299 }; | 289 }; |
300 | 290 |
301 } // namespace net | 291 } // namespace net |
302 | 292 |
303 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_H_ | 293 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_H_ |
OLD | NEW |