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 <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <list> | 11 #include <list> |
12 #include <string> | |
13 | 12 |
14 #include "base/macros.h" | 13 #include "base/macros.h" |
15 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
16 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
17 #include "net/base/completion_callback.h" | 16 #include "net/base/completion_callback.h" |
18 #include "net/base/host_port_pair.h" | 17 #include "net/base/host_port_pair.h" |
19 #include "net/base/load_timing_info.h" | 18 #include "net/base/load_timing_info.h" |
20 #include "net/base/net_export.h" | 19 #include "net/base/net_export.h" |
21 #include "net/http/http_auth_controller.h" | 20 #include "net/http/http_auth_controller.h" |
22 #include "net/http/http_request_headers.h" | 21 #include "net/http/http_request_headers.h" |
23 #include "net/http/http_request_info.h" | 22 #include "net/http/http_request_info.h" |
24 #include "net/http/http_response_info.h" | 23 #include "net/http/http_response_info.h" |
25 #include "net/http/proxy_client_socket.h" | 24 #include "net/http/proxy_client_socket.h" |
26 #include "net/log/net_log_source.h" | 25 #include "net/log/net_log_source.h" |
27 #include "net/log/net_log_with_source.h" | 26 #include "net/log/net_log_with_source.h" |
| 27 #include "net/spdy/platform/api/spdy_string.h" |
28 #include "net/spdy/spdy_http_stream.h" | 28 #include "net/spdy/spdy_http_stream.h" |
29 #include "net/spdy/spdy_protocol.h" | 29 #include "net/spdy/spdy_protocol.h" |
30 #include "net/spdy/spdy_read_queue.h" | 30 #include "net/spdy/spdy_read_queue.h" |
31 #include "net/spdy/spdy_session.h" | 31 #include "net/spdy/spdy_session.h" |
32 #include "net/spdy/spdy_stream.h" | 32 #include "net/spdy/spdy_stream.h" |
33 | 33 |
34 namespace net { | 34 namespace net { |
35 | 35 |
36 class HttpStream; | 36 class HttpStream; |
37 class IOBuffer; | 37 class IOBuffer; |
38 class SpdyStream; | 38 class SpdyStream; |
39 | 39 |
40 class NET_EXPORT_PRIVATE SpdyProxyClientSocket : public ProxyClientSocket, | 40 class NET_EXPORT_PRIVATE SpdyProxyClientSocket : public ProxyClientSocket, |
41 public SpdyStream::Delegate { | 41 public SpdyStream::Delegate { |
42 public: | 42 public: |
43 // Create a socket on top of the |spdy_stream| by sending a HEADERS CONNECT | 43 // Create a socket on top of the |spdy_stream| by sending a HEADERS CONNECT |
44 // frame for |endpoint|. After the response HEADERS frame is received, any | 44 // frame for |endpoint|. After the response HEADERS frame is received, any |
45 // data read/written to the socket will be transferred in data frames. This | 45 // data read/written to the socket will be transferred in data frames. This |
46 // object will set itself as |spdy_stream|'s delegate. | 46 // object will set itself as |spdy_stream|'s delegate. |
47 SpdyProxyClientSocket(const base::WeakPtr<SpdyStream>& spdy_stream, | 47 SpdyProxyClientSocket(const base::WeakPtr<SpdyStream>& spdy_stream, |
48 const std::string& user_agent, | 48 const SpdyString& user_agent, |
49 const HostPortPair& endpoint, | 49 const HostPortPair& endpoint, |
50 const HostPortPair& proxy_server, | 50 const HostPortPair& proxy_server, |
51 const NetLogWithSource& source_net_log, | 51 const NetLogWithSource& source_net_log, |
52 HttpAuthController* auth_controller); | 52 HttpAuthController* auth_controller); |
53 | 53 |
54 // On destruction Disconnect() is called. | 54 // On destruction Disconnect() is called. |
55 ~SpdyProxyClientSocket() override; | 55 ~SpdyProxyClientSocket() override; |
56 | 56 |
57 // ProxyClientSocket methods: | 57 // ProxyClientSocket methods: |
58 const HttpResponseInfo* GetConnectResponseInfo() const override; | 58 const HttpResponseInfo* GetConnectResponseInfo() const override; |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 | 144 |
145 // CONNECT request and response. | 145 // CONNECT request and response. |
146 HttpRequestInfo request_; | 146 HttpRequestInfo request_; |
147 HttpResponseInfo response_; | 147 HttpResponseInfo response_; |
148 | 148 |
149 // The hostname and port of the endpoint. This is not necessarily the one | 149 // The hostname and port of the endpoint. This is not necessarily the one |
150 // specified by the URL, due to Alternate-Protocol or fixed testing ports. | 150 // specified by the URL, due to Alternate-Protocol or fixed testing ports. |
151 const HostPortPair endpoint_; | 151 const HostPortPair endpoint_; |
152 scoped_refptr<HttpAuthController> auth_; | 152 scoped_refptr<HttpAuthController> auth_; |
153 | 153 |
154 std::string user_agent_; | 154 SpdyString user_agent_; |
155 | 155 |
156 // We buffer the response body as it arrives asynchronously from the stream. | 156 // We buffer the response body as it arrives asynchronously from the stream. |
157 SpdyReadQueue read_buffer_queue_; | 157 SpdyReadQueue read_buffer_queue_; |
158 | 158 |
159 // User provided buffer for the Read() response. | 159 // User provided buffer for the Read() response. |
160 scoped_refptr<IOBuffer> user_buffer_; | 160 scoped_refptr<IOBuffer> user_buffer_; |
161 size_t user_buffer_len_; | 161 size_t user_buffer_len_; |
162 | 162 |
163 // User specified number of bytes to be written. | 163 // User specified number of bytes to be written. |
164 int write_buffer_len_; | 164 int write_buffer_len_; |
(...skipping 14 matching lines...) Expand all Loading... |
179 // Only used for posting write callbacks. Weak pointers created by this | 179 // Only used for posting write callbacks. Weak pointers created by this |
180 // factory are invalidated in Disconnect(). | 180 // factory are invalidated in Disconnect(). |
181 base::WeakPtrFactory<SpdyProxyClientSocket> write_callback_weak_factory_; | 181 base::WeakPtrFactory<SpdyProxyClientSocket> write_callback_weak_factory_; |
182 | 182 |
183 DISALLOW_COPY_AND_ASSIGN(SpdyProxyClientSocket); | 183 DISALLOW_COPY_AND_ASSIGN(SpdyProxyClientSocket); |
184 }; | 184 }; |
185 | 185 |
186 } // namespace net | 186 } // namespace net |
187 | 187 |
188 #endif // NET_SPDY_SPDY_PROXY_CLIENT_SOCKET_H_ | 188 #endif // NET_SPDY_SPDY_PROXY_CLIENT_SOCKET_H_ |
OLD | NEW |