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_SOCKET_STREAM_SOCKET_STREAM_H_ | 5 #ifndef NET_SOCKET_STREAM_SOCKET_STREAM_H_ |
6 #define NET_SOCKET_STREAM_SOCKET_STREAM_H_ | 6 #define NET_SOCKET_STREAM_SOCKET_STREAM_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "net/socket/tcp_client_socket.h" | 26 #include "net/socket/tcp_client_socket.h" |
27 #include "net/url_request/url_request.h" | 27 #include "net/url_request/url_request.h" |
28 #include "net/url_request/url_request_context.h" | 28 #include "net/url_request/url_request_context.h" |
29 | 29 |
30 namespace net { | 30 namespace net { |
31 | 31 |
32 class AuthChallengeInfo; | 32 class AuthChallengeInfo; |
33 class ClientSocketFactory; | 33 class ClientSocketFactory; |
34 class CookieOptions; | 34 class CookieOptions; |
35 class HostResolver; | 35 class HostResolver; |
| 36 class HttpAuthController; |
36 class HttpAuthHandlerFactory; | 37 class HttpAuthHandlerFactory; |
37 class SSLConfigService; | 38 class SSLConfigService; |
38 class SSLInfo; | 39 class SSLInfo; |
39 class SingleRequestHostResolver; | 40 class SingleRequestHostResolver; |
40 class SocketStreamMetrics; | 41 class SocketStreamMetrics; |
41 | 42 |
42 // SocketStream is used to implement Web Sockets. | 43 // SocketStream is used to implement Web Sockets. |
43 // It provides plain full-duplex stream with proxy and SSL support. | 44 // It provides plain full-duplex stream with proxy and SSL support. |
44 // For proxy authentication, only basic mechanisum is supported. It will try | 45 // For proxy authentication, only basic mechanisum is supported. It will try |
45 // authentication identity for proxy URL first. If server requires proxy | 46 // authentication identity for proxy URL first. If server requires proxy |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 STATE_BEFORE_CONNECT, | 224 STATE_BEFORE_CONNECT, |
224 STATE_BEFORE_CONNECT_COMPLETE, | 225 STATE_BEFORE_CONNECT_COMPLETE, |
225 STATE_RESOLVE_PROXY, | 226 STATE_RESOLVE_PROXY, |
226 STATE_RESOLVE_PROXY_COMPLETE, | 227 STATE_RESOLVE_PROXY_COMPLETE, |
227 STATE_RESOLVE_HOST, | 228 STATE_RESOLVE_HOST, |
228 STATE_RESOLVE_HOST_COMPLETE, | 229 STATE_RESOLVE_HOST_COMPLETE, |
229 STATE_RESOLVE_PROTOCOL, | 230 STATE_RESOLVE_PROTOCOL, |
230 STATE_RESOLVE_PROTOCOL_COMPLETE, | 231 STATE_RESOLVE_PROTOCOL_COMPLETE, |
231 STATE_TCP_CONNECT, | 232 STATE_TCP_CONNECT, |
232 STATE_TCP_CONNECT_COMPLETE, | 233 STATE_TCP_CONNECT_COMPLETE, |
| 234 STATE_GENERATE_PROXY_AUTH_TOKEN, |
| 235 STATE_GENERATE_PROXY_AUTH_TOKEN_COMPLETE, |
233 STATE_WRITE_TUNNEL_HEADERS, | 236 STATE_WRITE_TUNNEL_HEADERS, |
234 STATE_WRITE_TUNNEL_HEADERS_COMPLETE, | 237 STATE_WRITE_TUNNEL_HEADERS_COMPLETE, |
235 STATE_READ_TUNNEL_HEADERS, | 238 STATE_READ_TUNNEL_HEADERS, |
236 STATE_READ_TUNNEL_HEADERS_COMPLETE, | 239 STATE_READ_TUNNEL_HEADERS_COMPLETE, |
237 STATE_SOCKS_CONNECT, | 240 STATE_SOCKS_CONNECT, |
238 STATE_SOCKS_CONNECT_COMPLETE, | 241 STATE_SOCKS_CONNECT_COMPLETE, |
239 STATE_SECURE_PROXY_CONNECT, | 242 STATE_SECURE_PROXY_CONNECT, |
240 STATE_SECURE_PROXY_CONNECT_COMPLETE, | 243 STATE_SECURE_PROXY_CONNECT_COMPLETE, |
241 STATE_SECURE_PROXY_HANDLE_CERT_ERROR, | 244 STATE_SECURE_PROXY_HANDLE_CERT_ERROR, |
242 STATE_SECURE_PROXY_HANDLE_CERT_ERROR_COMPLETE, | 245 STATE_SECURE_PROXY_HANDLE_CERT_ERROR_COMPLETE, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 int DoBeforeConnect(); | 284 int DoBeforeConnect(); |
282 int DoBeforeConnectComplete(int result); | 285 int DoBeforeConnectComplete(int result); |
283 int DoResolveProxy(); | 286 int DoResolveProxy(); |
284 int DoResolveProxyComplete(int result); | 287 int DoResolveProxyComplete(int result); |
285 int DoResolveHost(); | 288 int DoResolveHost(); |
286 int DoResolveHostComplete(int result); | 289 int DoResolveHostComplete(int result); |
287 int DoResolveProtocol(int result); | 290 int DoResolveProtocol(int result); |
288 int DoResolveProtocolComplete(int result); | 291 int DoResolveProtocolComplete(int result); |
289 int DoTcpConnect(int result); | 292 int DoTcpConnect(int result); |
290 int DoTcpConnectComplete(int result); | 293 int DoTcpConnectComplete(int result); |
| 294 int DoGenerateProxyAuthToken(); |
| 295 int DoGenerateProxyAuthTokenComplete(int result); |
291 int DoWriteTunnelHeaders(); | 296 int DoWriteTunnelHeaders(); |
292 int DoWriteTunnelHeadersComplete(int result); | 297 int DoWriteTunnelHeadersComplete(int result); |
293 int DoReadTunnelHeaders(); | 298 int DoReadTunnelHeaders(); |
294 int DoReadTunnelHeadersComplete(int result); | 299 int DoReadTunnelHeadersComplete(int result); |
295 int DoSOCKSConnect(); | 300 int DoSOCKSConnect(); |
296 int DoSOCKSConnectComplete(int result); | 301 int DoSOCKSConnectComplete(int result); |
297 int DoSecureProxyConnect(); | 302 int DoSecureProxyConnect(); |
298 int DoSecureProxyConnectComplete(int result); | 303 int DoSecureProxyConnectComplete(int result); |
299 int DoSecureProxyHandleCertError(int result); | 304 int DoSecureProxyHandleCertError(int result); |
300 int DoSecureProxyHandleCertErrorComplete(int result); | 305 int DoSecureProxyHandleCertErrorComplete(int result); |
301 int DoSSLConnect(); | 306 int DoSSLConnect(); |
302 int DoSSLConnectComplete(int result); | 307 int DoSSLConnectComplete(int result); |
303 int DoSSLHandleCertError(int result); | 308 int DoSSLHandleCertError(int result); |
304 int DoSSLHandleCertErrorComplete(int result); | 309 int DoSSLHandleCertErrorComplete(int result); |
305 int DoReadWrite(int result); | 310 int DoReadWrite(int result); |
306 | 311 |
307 GURL ProxyAuthOrigin() const; | 312 GURL ProxyAuthOrigin() const; |
308 int HandleAuthChallenge(const HttpResponseHeaders* headers); | 313 int HandleAuthChallenge(const HttpResponseHeaders* headers); |
309 int HandleCertificateRequest(int result, SSLConfig* ssl_config); | 314 int HandleCertificateRequest(int result, SSLConfig* ssl_config); |
310 void DoAuthRequired(); | 315 void DoAuthRequired(); |
311 void DoRestartWithAuth(); | 316 void DoRestartWithAuth(); |
312 | 317 |
313 int HandleCertificateError(int result); | 318 int HandleCertificateError(int result); |
314 int AllowCertErrorForReconnection(SSLConfig* ssl_config); | 319 int AllowCertErrorForReconnection(SSLConfig* ssl_config); |
315 | 320 |
| 321 bool ShouldApplyProxyAuth() const; |
| 322 |
316 SSLConfigService* ssl_config_service() const; | 323 SSLConfigService* ssl_config_service() const; |
317 ProxyService* proxy_service() const; | 324 ProxyService* proxy_service() const; |
318 | 325 |
319 BoundNetLog net_log_; | 326 BoundNetLog net_log_; |
320 | 327 |
321 GURL url_; | 328 GURL url_; |
322 int max_pending_send_allowed_; | 329 int max_pending_send_allowed_; |
323 const URLRequestContext* context_; | 330 const URLRequestContext* context_; |
324 | 331 |
325 UserDataMap user_data_; | 332 UserDataMap user_data_; |
326 | 333 |
327 State next_state_; | 334 State next_state_; |
328 HostResolver* host_resolver_; | 335 HostResolver* host_resolver_; |
329 CertVerifier* cert_verifier_; | 336 CertVerifier* cert_verifier_; |
330 ServerBoundCertService* server_bound_cert_service_; | 337 ServerBoundCertService* server_bound_cert_service_; |
331 HttpAuthHandlerFactory* http_auth_handler_factory_; | |
332 ClientSocketFactory* factory_; | 338 ClientSocketFactory* factory_; |
333 | 339 |
334 ProxyMode proxy_mode_; | 340 ProxyMode proxy_mode_; |
335 | 341 |
336 GURL proxy_url_; | 342 GURL proxy_url_; |
337 ProxyService::PacRequest* pac_request_; | 343 ProxyService::PacRequest* pac_request_; |
338 ProxyInfo proxy_info_; | 344 ProxyInfo proxy_info_; |
339 | 345 |
340 HttpAuthCache auth_cache_; | 346 scoped_refptr<HttpAuthController> proxy_auth_controller_; |
341 scoped_ptr<HttpAuthHandler> auth_handler_; | |
342 HttpAuth::Identity auth_identity_; | |
343 scoped_refptr<AuthChallengeInfo> auth_info_; | |
344 | 347 |
345 scoped_refptr<RequestHeaders> tunnel_request_headers_; | 348 scoped_refptr<RequestHeaders> tunnel_request_headers_; |
346 size_t tunnel_request_headers_bytes_sent_; | 349 size_t tunnel_request_headers_bytes_sent_; |
347 scoped_refptr<ResponseHeaders> tunnel_response_headers_; | 350 scoped_refptr<ResponseHeaders> tunnel_response_headers_; |
348 int tunnel_response_headers_capacity_; | 351 int tunnel_response_headers_capacity_; |
349 int tunnel_response_headers_len_; | 352 int tunnel_response_headers_len_; |
350 | 353 |
351 scoped_ptr<SingleRequestHostResolver> resolver_; | 354 scoped_ptr<SingleRequestHostResolver> resolver_; |
352 AddressList addresses_; | 355 AddressList addresses_; |
353 scoped_ptr<StreamSocket> socket_; | 356 scoped_ptr<StreamSocket> socket_; |
(...skipping 22 matching lines...) Expand all Loading... |
376 bool server_closed_; | 379 bool server_closed_; |
377 | 380 |
378 scoped_ptr<SocketStreamMetrics> metrics_; | 381 scoped_ptr<SocketStreamMetrics> metrics_; |
379 | 382 |
380 DISALLOW_COPY_AND_ASSIGN(SocketStream); | 383 DISALLOW_COPY_AND_ASSIGN(SocketStream); |
381 }; | 384 }; |
382 | 385 |
383 } // namespace net | 386 } // namespace net |
384 | 387 |
385 #endif // NET_SOCKET_STREAM_SOCKET_STREAM_H_ | 388 #endif // NET_SOCKET_STREAM_SOCKET_STREAM_H_ |
OLD | NEW |