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