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_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 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.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/load_timing_info.h" | 16 #include "net/base/load_timing_info.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/http/proxy_client_socket.h" | 21 #include "net/http/proxy_client_socket.h" |
22 #include "net/log/net_log.h" | 22 #include "net/log/net_log.h" |
23 #include "net/spdy/spdy_http_stream.h" | 23 #include "net/spdy/spdy_http_stream.h" |
24 #include "net/spdy/spdy_protocol.h" | 24 #include "net/spdy/spdy_protocol.h" |
25 #include "net/spdy/spdy_read_queue.h" | 25 #include "net/spdy/spdy_read_queue.h" |
26 #include "net/spdy/spdy_session.h" | 26 #include "net/spdy/spdy_session.h" |
27 #include "net/spdy/spdy_stream.h" | 27 #include "net/spdy/spdy_stream.h" |
28 | 28 |
29 | |
30 class GURL; | |
31 | |
32 namespace net { | 29 namespace net { |
33 | 30 |
34 class AddressList; | 31 class AddressList; |
35 class HttpStream; | 32 class HttpStream; |
36 class IOBuffer; | 33 class IOBuffer; |
37 class SpdyStream; | 34 class SpdyStream; |
38 | 35 |
39 class NET_EXPORT_PRIVATE SpdyProxyClientSocket : public ProxyClientSocket, | 36 class NET_EXPORT_PRIVATE SpdyProxyClientSocket : public ProxyClientSocket, |
40 public SpdyStream::Delegate { | 37 public SpdyStream::Delegate { |
41 public: | 38 public: |
42 // Create a socket on top of the |spdy_stream| by sending a SYN_STREAM | 39 // Create a socket on top of the |spdy_stream| by sending a SYN_STREAM |
43 // CONNECT frame for |endpoint|. After the SYN_REPLY is received, | 40 // CONNECT frame for |endpoint|. After the SYN_REPLY is received, |
44 // any data read/written to the socket will be transferred in data | 41 // any data read/written to the socket will be transferred in data |
45 // frames. This object will set itself as |spdy_stream|'s delegate. | 42 // frames. This object will set itself as |spdy_stream|'s delegate. |
46 SpdyProxyClientSocket(const base::WeakPtr<SpdyStream>& spdy_stream, | 43 SpdyProxyClientSocket(const base::WeakPtr<SpdyStream>& spdy_stream, |
47 const std::string& user_agent, | 44 const std::string& user_agent, |
48 const HostPortPair& endpoint, | 45 const HostPortPair& endpoint, |
49 const GURL& url, | |
50 const HostPortPair& proxy_server, | 46 const HostPortPair& proxy_server, |
51 const BoundNetLog& source_net_log, | 47 const BoundNetLog& source_net_log, |
52 HttpAuthCache* auth_cache, | 48 HttpAuthCache* auth_cache, |
53 HttpAuthHandlerFactory* auth_handler_factory); | 49 HttpAuthHandlerFactory* auth_handler_factory); |
54 | 50 |
55 | 51 |
56 // On destruction Disconnect() is called. | 52 // On destruction Disconnect() is called. |
57 ~SpdyProxyClientSocket() override; | 53 ~SpdyProxyClientSocket() override; |
58 | 54 |
59 // ProxyClientSocket methods: | 55 // ProxyClientSocket methods: |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 | 138 |
143 // CONNECT request and response. | 139 // CONNECT request and response. |
144 HttpRequestInfo request_; | 140 HttpRequestInfo request_; |
145 HttpResponseInfo response_; | 141 HttpResponseInfo response_; |
146 | 142 |
147 // The hostname and port of the endpoint. This is not necessarily the one | 143 // The hostname and port of the endpoint. This is not necessarily the one |
148 // specified by the URL, due to Alternate-Protocol or fixed testing ports. | 144 // specified by the URL, due to Alternate-Protocol or fixed testing ports. |
149 const HostPortPair endpoint_; | 145 const HostPortPair endpoint_; |
150 scoped_refptr<HttpAuthController> auth_; | 146 scoped_refptr<HttpAuthController> auth_; |
151 | 147 |
| 148 std::string user_agent_; |
| 149 |
152 // We buffer the response body as it arrives asynchronously from the stream. | 150 // We buffer the response body as it arrives asynchronously from the stream. |
153 SpdyReadQueue read_buffer_queue_; | 151 SpdyReadQueue read_buffer_queue_; |
154 | 152 |
155 // User provided buffer for the Read() response. | 153 // User provided buffer for the Read() response. |
156 scoped_refptr<IOBuffer> user_buffer_; | 154 scoped_refptr<IOBuffer> user_buffer_; |
157 size_t user_buffer_len_; | 155 size_t user_buffer_len_; |
158 | 156 |
159 // User specified number of bytes to be written. | 157 // User specified number of bytes to be written. |
160 int write_buffer_len_; | 158 int write_buffer_len_; |
161 | 159 |
(...skipping 12 matching lines...) Expand all Loading... |
174 // Only used for posting write callbacks. Weak pointers created by this | 172 // Only used for posting write callbacks. Weak pointers created by this |
175 // factory are invalidated in Disconnect(). | 173 // factory are invalidated in Disconnect(). |
176 base::WeakPtrFactory<SpdyProxyClientSocket> write_callback_weak_factory_; | 174 base::WeakPtrFactory<SpdyProxyClientSocket> write_callback_weak_factory_; |
177 | 175 |
178 DISALLOW_COPY_AND_ASSIGN(SpdyProxyClientSocket); | 176 DISALLOW_COPY_AND_ASSIGN(SpdyProxyClientSocket); |
179 }; | 177 }; |
180 | 178 |
181 } // namespace net | 179 } // namespace net |
182 | 180 |
183 #endif // NET_SPDY_SPDY_PROXY_CLIENT_SOCKET_H_ | 181 #endif // NET_SPDY_SPDY_PROXY_CLIENT_SOCKET_H_ |
OLD | NEW |