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