OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_SPDY_SPDY_PROXY_CLIENT_SOCKET_H_ | 5 #ifndef NET_SPDY_SPDY_PROXY_CLIENT_SOCKET_H_ |
6 #define NET_SPDY_SPDY_PROXY_CLIENT_SOCKET_H_ | 6 #define NET_SPDY_SPDY_PROXY_CLIENT_SOCKET_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <list> | 10 #include <list> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/ref_counted.h" | 13 #include "base/ref_counted.h" |
14 #include "net/base/completion_callback.h" | 14 #include "net/base/completion_callback.h" |
15 #include "net/base/host_port_pair.h" | 15 #include "net/base/host_port_pair.h" |
16 #include "net/base/net_log.h" | 16 #include "net/base/net_log.h" |
17 #include "net/http/http_auth_controller.h" | 17 #include "net/http/http_auth_controller.h" |
18 #include "net/http/http_request_headers.h" | 18 #include "net/http/http_request_headers.h" |
19 #include "net/http/http_request_info.h" | 19 #include "net/http/http_request_info.h" |
20 #include "net/http/http_response_info.h" | 20 #include "net/http/http_response_info.h" |
21 #include "net/socket/client_socket.h" | 21 #include "net/http/proxy_client_socket.h" |
22 #include "net/spdy/spdy_http_stream.h" | |
22 #include "net/spdy/spdy_protocol.h" | 23 #include "net/spdy/spdy_protocol.h" |
23 #include "net/spdy/spdy_session.h" | 24 #include "net/spdy/spdy_session.h" |
24 #include "net/spdy/spdy_stream.h" | 25 #include "net/spdy/spdy_stream.h" |
25 | 26 |
26 | 27 |
27 class GURL; | 28 class GURL; |
28 | 29 |
29 namespace net { | 30 namespace net { |
30 | 31 |
31 class AddressList; | 32 class AddressList; |
32 class ClientSocketHandle; | 33 class ClientSocketHandle; |
33 class HttpStream; | 34 class HttpStream; |
34 class IOBuffer; | 35 class IOBuffer; |
35 class SpdySession; | 36 class SpdySession; |
36 class SpdyStream; | 37 class SpdyStream; |
37 | 38 |
38 class SpdyProxyClientSocket : public ClientSocket, public SpdyStream::Delegate { | 39 class SpdyProxyClientSocket : public ProxyClientSocket, |
40 public SpdyStream::Delegate { | |
39 public: | 41 public: |
40 // Create a socket on top of the |spdy_stream| by sending a SYN_STREAM | 42 // Create a socket on top of the |spdy_stream| by sending a SYN_STREAM |
41 // CONNECT frame for |endpoint|. After the SYN_REPLY is received, | 43 // CONNECT frame for |endpoint|. After the SYN_REPLY is received, |
42 // any data read/written to the socket will be transferred in data | 44 // any data read/written to the socket will be transferred in data |
43 // frames. | 45 // frames. |
44 SpdyProxyClientSocket(SpdyStream* spdy_stream, | 46 SpdyProxyClientSocket(SpdyStream* spdy_stream, |
45 const std::string& user_agent, | 47 const std::string& user_agent, |
46 const HostPortPair& endpoint, | 48 const HostPortPair& endpoint, |
47 const GURL& url, | 49 const GURL& url, |
48 const HostPortPair& proxy_server, | 50 const HostPortPair& proxy_server, |
49 HttpAuthCache* auth_cache, | 51 HttpAuthCache* auth_cache, |
50 HttpAuthHandlerFactory* auth_handler_factory); | 52 HttpAuthHandlerFactory* auth_handler_factory); |
51 | 53 |
52 | 54 |
53 // On destruction Disconnect() is called. | 55 // On destruction Disconnect() is called. |
54 virtual ~SpdyProxyClientSocket(); | 56 virtual ~SpdyProxyClientSocket(); |
55 | 57 |
56 const scoped_refptr<HttpAuthController>& auth_controller() { | 58 const scoped_refptr<HttpAuthController>& auth_controller() { |
57 return auth_; | 59 return auth_; |
58 } | 60 } |
59 | 61 |
60 const HttpResponseInfo* GetConnectResponseInfo() const { | 62 // HttpProxyTunnelClientSocket methods: |
vandebo (ex-Chrome)
2010/12/16 17:59:23
nit: ProxyClientSocket
| |
63 | |
64 virtual const HttpResponseInfo* GetConnectResponseInfo() const { | |
61 return response_.headers ? &response_ : NULL; | 65 return response_.headers ? &response_ : NULL; |
62 } | 66 } |
63 | 67 |
68 // In the event of a non-200 response to the CONNECT request, this | |
69 // method may be called to return an HttpStream in order to read | |
70 // the response body. | |
71 virtual HttpStream* CreateConnectResponseStream(); | |
72 | |
64 // ClientSocket methods: | 73 // ClientSocket methods: |
65 virtual int Connect(CompletionCallback* callback); | 74 virtual int Connect(CompletionCallback* callback); |
66 virtual void Disconnect(); | 75 virtual void Disconnect(); |
67 virtual bool IsConnected() const; | 76 virtual bool IsConnected() const; |
68 virtual bool IsConnectedAndIdle() const; | 77 virtual bool IsConnectedAndIdle() const; |
69 virtual const BoundNetLog& NetLog() const { return net_log_; } | 78 virtual const BoundNetLog& NetLog() const { return net_log_; } |
70 virtual void SetSubresourceSpeculation(); | 79 virtual void SetSubresourceSpeculation(); |
71 virtual void SetOmniboxSpeculation(); | 80 virtual void SetOmniboxSpeculation(); |
72 virtual bool WasEverUsed() const; | 81 virtual bool WasEverUsed() const; |
73 virtual bool UsingTCPFastOpen() const; | 82 virtual bool UsingTCPFastOpen() const; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
145 // User specified number of bytes to be written. | 154 // User specified number of bytes to be written. |
146 int write_buffer_len_; | 155 int write_buffer_len_; |
147 // Number of bytes written which have not been confirmed | 156 // Number of bytes written which have not been confirmed |
148 int write_bytes_outstanding_; | 157 int write_bytes_outstanding_; |
149 | 158 |
150 // True if read has ever returned zero for eof. | 159 // True if read has ever returned zero for eof. |
151 bool eof_has_been_read_; | 160 bool eof_has_been_read_; |
152 // True if the transport socket has ever sent data. | 161 // True if the transport socket has ever sent data. |
153 bool was_ever_used_; | 162 bool was_ever_used_; |
154 | 163 |
164 scoped_ptr<SpdyHttpStream> response_stream_; | |
165 | |
155 const BoundNetLog net_log_; | 166 const BoundNetLog net_log_; |
156 | 167 |
157 DISALLOW_COPY_AND_ASSIGN(SpdyProxyClientSocket); | 168 DISALLOW_COPY_AND_ASSIGN(SpdyProxyClientSocket); |
158 }; | 169 }; |
159 | 170 |
160 } // namespace net | 171 } // namespace net |
161 | 172 |
162 #endif // NET_SPDY_SPDY_PROXY_CLIENT_SOCKET_H_ | 173 #endif // NET_SPDY_SPDY_PROXY_CLIENT_SOCKET_H_ |
OLD | NEW |