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_HTTP_HTTP_PROXY_CLIENT_SOCKET_H_ | 5 #ifndef NET_HTTP_HTTP_PROXY_CLIENT_SOCKET_H_ |
6 #define NET_HTTP_HTTP_PROXY_CLIENT_SOCKET_H_ | 6 #define NET_HTTP_HTTP_PROXY_CLIENT_SOCKET_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/ref_counted.h" | 12 #include "base/ref_counted.h" |
13 #include "net/base/completion_callback.h" | 13 #include "net/base/completion_callback.h" |
14 #include "net/base/host_port_pair.h" | 14 #include "net/base/host_port_pair.h" |
15 #include "net/base/net_log.h" | 15 #include "net/base/net_log.h" |
16 #include "net/http/http_proxy_tunnel_client_socket.h" | |
willchan no longer on Chromium
2010/12/14 00:34:42
Sort alphabetically?
Ryan Hamilton
2010/12/15 20:14:17
Done.
| |
16 #include "net/http/http_auth_controller.h" | 17 #include "net/http/http_auth_controller.h" |
17 #include "net/http/http_request_headers.h" | 18 #include "net/http/http_request_headers.h" |
18 #include "net/http/http_request_info.h" | 19 #include "net/http/http_request_info.h" |
19 #include "net/http/http_response_info.h" | 20 #include "net/http/http_response_info.h" |
20 #include "net/socket/client_socket.h" | |
21 | 21 |
22 class GURL; | 22 class GURL; |
23 | 23 |
24 namespace net { | 24 namespace net { |
25 | 25 |
26 class AddressList; | 26 class AddressList; |
27 class ClientSocketHandle; | 27 class ClientSocketHandle; |
28 class GrowableIOBuffer; | 28 class GrowableIOBuffer; |
29 class HttpAuthCache; | 29 class HttpAuthCache; |
30 class HttpAuthHandleFactory; | 30 class HttpAuthHandleFactory; |
31 class HttpStream; | 31 class HttpStream; |
32 class HttpStreamParser; | 32 class HttpStreamParser; |
33 class IOBuffer; | 33 class IOBuffer; |
34 | 34 |
35 class HttpProxyClientSocket : public ClientSocket { | 35 class HttpProxyClientSocket : public HttpProxyTunnelClientSocket { |
willchan no longer on Chromium
2010/12/14 00:34:42
This naming looks weird. I didn't read through al
Ryan Hamilton
2010/12/15 20:14:17
You're right, I missed one. Thanks!
| |
36 public: | 36 public: |
37 // Takes ownership of |transport_socket|, which should already be connected | 37 // Takes ownership of |transport_socket|, which should already be connected |
38 // by the time Connect() is called. If tunnel is true then on Connect() | 38 // by the time Connect() is called. If tunnel is true then on Connect() |
39 // this socket will establish an Http tunnel. | 39 // this socket will establish an Http tunnel. |
40 HttpProxyClientSocket(ClientSocketHandle* transport_socket, | 40 HttpProxyClientSocket(ClientSocketHandle* transport_socket, |
41 const GURL& request_url, | 41 const GURL& request_url, |
42 const std::string& user_agent, | 42 const std::string& user_agent, |
43 const HostPortPair& endpoint, | 43 const HostPortPair& endpoint, |
44 const HostPortPair& proxy_server, | 44 const HostPortPair& proxy_server, |
45 HttpAuthCache* http_auth_cache, | 45 HttpAuthCache* http_auth_cache, |
46 HttpAuthHandlerFactory* http_auth_handler_factory, | 46 HttpAuthHandlerFactory* http_auth_handler_factory, |
47 bool tunnel, | 47 bool tunnel, |
48 bool using_spdy); | 48 bool using_spdy, |
49 bool is_https_proxy); | |
49 | 50 |
50 // On destruction Disconnect() is called. | 51 // On destruction Disconnect() is called. |
51 virtual ~HttpProxyClientSocket(); | 52 virtual ~HttpProxyClientSocket(); |
52 | 53 |
53 // If Connect (or its callback) returns PROXY_AUTH_REQUESTED, then | 54 // If Connect (or its callback) returns PROXY_AUTH_REQUESTED, then |
54 // credentials should be added to the HttpAuthController before calling | 55 // credentials should be added to the HttpAuthController before calling |
55 // RestartWithAuth. | 56 // RestartWithAuth. |
56 int RestartWithAuth(CompletionCallback* callback); | 57 int RestartWithAuth(CompletionCallback* callback); |
57 | 58 |
58 const HttpResponseInfo* GetResponseInfo() const { | 59 const HttpResponseInfo* GetConnectResponseInfo() const { |
59 return response_.headers ? &response_ : NULL; | 60 return response_.headers ? &response_ : NULL; |
60 } | 61 } |
61 | 62 |
63 virtual HttpStream* GetConnectResponseStream(); | |
64 | |
62 const scoped_refptr<HttpAuthController>& auth_controller() { | 65 const scoped_refptr<HttpAuthController>& auth_controller() { |
63 return auth_; | 66 return auth_; |
64 } | 67 } |
65 | 68 |
66 bool using_spdy() { | 69 bool using_spdy() { |
67 return using_spdy_; | 70 return using_spdy_; |
68 } | 71 } |
69 | 72 |
70 // ClientSocket methods: | 73 // ClientSocket methods: |
71 | 74 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
139 CompletionCallback* user_callback_; | 142 CompletionCallback* user_callback_; |
140 | 143 |
141 HttpRequestInfo request_; | 144 HttpRequestInfo request_; |
142 HttpResponseInfo response_; | 145 HttpResponseInfo response_; |
143 | 146 |
144 scoped_refptr<GrowableIOBuffer> parser_buf_; | 147 scoped_refptr<GrowableIOBuffer> parser_buf_; |
145 scoped_ptr<HttpStreamParser> http_stream_parser_; | 148 scoped_ptr<HttpStreamParser> http_stream_parser_; |
146 scoped_refptr<IOBuffer> drain_buf_; | 149 scoped_refptr<IOBuffer> drain_buf_; |
147 | 150 |
148 // Stores the underlying socket. | 151 // Stores the underlying socket. |
149 const scoped_ptr<ClientSocketHandle> transport_; | 152 scoped_ptr<ClientSocketHandle> transport_; |
150 | 153 |
151 // The hostname and port of the endpoint. This is not necessarily the one | 154 // The hostname and port of the endpoint. This is not necessarily the one |
152 // specified by the URL, due to Alternate-Protocol or fixed testing ports. | 155 // specified by the URL, due to Alternate-Protocol or fixed testing ports. |
153 const HostPortPair endpoint_; | 156 const HostPortPair endpoint_; |
154 scoped_refptr<HttpAuthController> auth_; | 157 scoped_refptr<HttpAuthController> auth_; |
155 const bool tunnel_; | 158 const bool tunnel_; |
156 // If true, then the connection to the proxy is a SPDY connection. | 159 // If true, then the connection to the proxy is a SPDY connection. |
157 const bool using_spdy_; | 160 const bool using_spdy_; |
161 // If true, then SSL is used to communicate with this proxy | |
162 const bool is_https_proxy_; | |
158 | 163 |
159 std::string request_line_; | 164 std::string request_line_; |
160 HttpRequestHeaders request_headers_; | 165 HttpRequestHeaders request_headers_; |
161 | 166 |
162 const BoundNetLog net_log_; | 167 const BoundNetLog net_log_; |
163 | 168 |
164 DISALLOW_COPY_AND_ASSIGN(HttpProxyClientSocket); | 169 DISALLOW_COPY_AND_ASSIGN(HttpProxyClientSocket); |
165 }; | 170 }; |
166 | 171 |
167 } // namespace net | 172 } // namespace net |
168 | 173 |
169 #endif // NET_HTTP_HTTP_PROXY_CLIENT_SOCKET_H_ | 174 #endif // NET_HTTP_HTTP_PROXY_CLIENT_SOCKET_H_ |
OLD | NEW |