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/connect_response_http_stream.h" | |
17 #include "net/http/http_proxy_tunnel_client_socket.h" | |
16 #include "net/http/http_auth_controller.h" | 18 #include "net/http/http_auth_controller.h" |
17 #include "net/http/http_request_headers.h" | 19 #include "net/http/http_request_headers.h" |
18 #include "net/http/http_request_info.h" | 20 #include "net/http/http_request_info.h" |
19 #include "net/http/http_response_info.h" | 21 #include "net/http/http_response_info.h" |
20 #include "net/socket/client_socket.h" | |
21 | 22 |
22 class GURL; | 23 class GURL; |
23 | 24 |
24 namespace net { | 25 namespace net { |
25 | 26 |
26 class AddressList; | 27 class AddressList; |
27 class ClientSocketHandle; | 28 class ClientSocketHandle; |
28 class GrowableIOBuffer; | 29 class GrowableIOBuffer; |
29 class HttpAuthCache; | 30 class HttpAuthCache; |
30 class HttpAuthHandleFactory; | 31 class HttpAuthHandleFactory; |
31 class HttpStream; | 32 class HttpStream; |
32 class HttpStreamParser; | 33 class HttpStreamParser; |
33 class IOBuffer; | 34 class IOBuffer; |
34 | 35 |
35 class HttpProxyClientSocket : public ClientSocket { | 36 class HttpProxyClientSocket : public HttpProxyTunnelClientSocket { |
36 public: | 37 public: |
37 // Takes ownership of |transport_socket|, which should already be connected | 38 // Takes ownership of |transport_socket|, which should already be connected |
38 // by the time Connect() is called. If tunnel is true then on Connect() | 39 // by the time Connect() is called. If tunnel is true then on Connect() |
39 // this socket will establish an Http tunnel. | 40 // this socket will establish an Http tunnel. |
40 HttpProxyClientSocket(ClientSocketHandle* transport_socket, | 41 HttpProxyClientSocket(ClientSocketHandle* transport_socket, |
41 const GURL& request_url, | 42 const GURL& request_url, |
42 const std::string& user_agent, | 43 const std::string& user_agent, |
43 const HostPortPair& endpoint, | 44 const HostPortPair& endpoint, |
44 const HostPortPair& proxy_server, | 45 const HostPortPair& proxy_server, |
45 HttpAuthCache* http_auth_cache, | 46 HttpAuthCache* http_auth_cache, |
46 HttpAuthHandlerFactory* http_auth_handler_factory, | 47 HttpAuthHandlerFactory* http_auth_handler_factory, |
47 bool tunnel, | 48 bool tunnel, |
48 bool using_spdy); | 49 bool using_spdy, |
50 bool is_https_proxy); | |
vandebo (ex-Chrome)
2010/12/04 00:30:37
Can you look at proxy_server instead of passing is
Ryan Hamilton
2010/12/09 21:19:35
Alas not. proxy_server is merely a HostPortPair,
| |
49 | 51 |
50 // On destruction Disconnect() is called. | 52 // On destruction Disconnect() is called. |
51 virtual ~HttpProxyClientSocket(); | 53 virtual ~HttpProxyClientSocket(); |
52 | 54 |
53 // If Connect (or its callback) returns PROXY_AUTH_REQUESTED, then | 55 // If Connect (or its callback) returns PROXY_AUTH_REQUESTED, then |
54 // credentials should be added to the HttpAuthController before calling | 56 // credentials should be added to the HttpAuthController before calling |
55 // RestartWithAuth. | 57 // RestartWithAuth. |
56 int RestartWithAuth(CompletionCallback* callback); | 58 int RestartWithAuth(CompletionCallback* callback); |
57 | 59 |
58 const HttpResponseInfo* GetResponseInfo() const { | 60 const HttpResponseInfo* GetConnectResponseInfo() const { |
59 return response_.headers ? &response_ : NULL; | 61 return response_.headers ? &response_ : NULL; |
60 } | 62 } |
61 | 63 |
64 virtual HttpStream* GetConnectResponseStream() { | |
vandebo (ex-Chrome)
2010/12/04 00:30:37
This should probably go in the .cpp file (and take
Ryan Hamilton
2010/12/09 21:19:35
Done.
| |
65 return new ConnectResponseHttpStream(http_stream_parser_.release()); | |
66 } | |
67 | |
62 const scoped_refptr<HttpAuthController>& auth_controller() { | 68 const scoped_refptr<HttpAuthController>& auth_controller() { |
63 return auth_; | 69 return auth_; |
64 } | 70 } |
65 | 71 |
66 bool using_spdy() { | 72 bool using_spdy() { |
67 return using_spdy_; | 73 return using_spdy_; |
68 } | 74 } |
69 | 75 |
70 // ClientSocket methods: | 76 // ClientSocket methods: |
71 | 77 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
148 // Stores the underlying socket. | 154 // Stores the underlying socket. |
149 const scoped_ptr<ClientSocketHandle> transport_; | 155 const scoped_ptr<ClientSocketHandle> transport_; |
150 | 156 |
151 // The hostname and port of the endpoint. This is not necessarily the one | 157 // 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. | 158 // specified by the URL, due to Alternate-Protocol or fixed testing ports. |
153 const HostPortPair endpoint_; | 159 const HostPortPair endpoint_; |
154 scoped_refptr<HttpAuthController> auth_; | 160 scoped_refptr<HttpAuthController> auth_; |
155 const bool tunnel_; | 161 const bool tunnel_; |
156 // If true, then the connection to the proxy is a SPDY connection. | 162 // If true, then the connection to the proxy is a SPDY connection. |
157 const bool using_spdy_; | 163 const bool using_spdy_; |
164 // If true, then SSL is used to communicate with this proxy | |
165 const bool is_https_proxy_; | |
158 | 166 |
159 std::string request_line_; | 167 std::string request_line_; |
160 HttpRequestHeaders request_headers_; | 168 HttpRequestHeaders request_headers_; |
161 | 169 |
162 const BoundNetLog net_log_; | 170 const BoundNetLog net_log_; |
163 | 171 |
164 DISALLOW_COPY_AND_ASSIGN(HttpProxyClientSocket); | 172 DISALLOW_COPY_AND_ASSIGN(HttpProxyClientSocket); |
165 }; | 173 }; |
166 | 174 |
167 } // namespace net | 175 } // namespace net |
168 | 176 |
169 #endif // NET_HTTP_HTTP_PROXY_CLIENT_SOCKET_H_ | 177 #endif // NET_HTTP_HTTP_PROXY_CLIENT_SOCKET_H_ |
OLD | NEW |