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 |
(...skipping 21 matching lines...) Expand all Loading... |
32 public: | 32 public: |
33 // Takes ownership of |transport_socket|, which should already be connected | 33 // Takes ownership of |transport_socket|, which should already be connected |
34 // by the time Connect() is called. If tunnel is true then on Connect() | 34 // by the time Connect() is called. If tunnel is true then on Connect() |
35 // this socket will establish an Http tunnel. | 35 // this socket will establish an Http tunnel. |
36 HttpProxyClientSocket(ClientSocketHandle* transport_socket, | 36 HttpProxyClientSocket(ClientSocketHandle* transport_socket, |
37 const GURL& request_url, | 37 const GURL& request_url, |
38 const std::string& user_agent, | 38 const std::string& user_agent, |
39 const HostPortPair& endpoint, | 39 const HostPortPair& endpoint, |
40 const HostPortPair& proxy_server, | 40 const HostPortPair& proxy_server, |
41 const scoped_refptr<HttpNetworkSession>& session, | 41 const scoped_refptr<HttpNetworkSession>& session, |
42 bool tunnel); | 42 bool tunnel, |
| 43 bool using_spdy); |
43 | 44 |
44 // On destruction Disconnect() is called. | 45 // On destruction Disconnect() is called. |
45 virtual ~HttpProxyClientSocket(); | 46 virtual ~HttpProxyClientSocket(); |
46 | 47 |
47 // If Connect (or its callback) returns PROXY_AUTH_REQUESTED, then | 48 // If Connect (or its callback) returns PROXY_AUTH_REQUESTED, then |
48 // credentials should be added to the HttpAuthController before calling | 49 // credentials should be added to the HttpAuthController before calling |
49 // RestartWithAuth. | 50 // RestartWithAuth. |
50 int RestartWithAuth(CompletionCallback* callback); | 51 int RestartWithAuth(CompletionCallback* callback); |
51 | 52 |
52 const HttpResponseInfo* GetResponseInfo() const { | 53 const HttpResponseInfo* GetResponseInfo() const { |
53 return response_.headers ? &response_ : NULL; | 54 return response_.headers ? &response_ : NULL; |
54 } | 55 } |
55 | 56 |
56 const scoped_refptr<HttpAuthController>& auth_controller() { | 57 const scoped_refptr<HttpAuthController>& auth_controller() { |
57 return auth_; | 58 return auth_; |
58 } | 59 } |
59 | 60 |
| 61 bool using_spdy() { |
| 62 return using_spdy_; |
| 63 } |
| 64 |
60 // ClientSocket methods: | 65 // ClientSocket methods: |
61 | 66 |
62 // Authenticates to the Http Proxy and then passes data freely. | 67 // Authenticates to the Http Proxy and then passes data freely. |
63 virtual int Connect(CompletionCallback* callback); | 68 virtual int Connect(CompletionCallback* callback); |
64 virtual void Disconnect(); | 69 virtual void Disconnect(); |
65 virtual bool IsConnected() const; | 70 virtual bool IsConnected() const; |
66 virtual bool IsConnectedAndIdle() const; | 71 virtual bool IsConnectedAndIdle() const; |
67 virtual const BoundNetLog& NetLog() const { return net_log_; } | 72 virtual const BoundNetLog& NetLog() const { return net_log_; } |
68 virtual void SetSubresourceSpeculation(); | 73 virtual void SetSubresourceSpeculation(); |
69 virtual void SetOmniboxSpeculation(); | 74 virtual void SetOmniboxSpeculation(); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 scoped_refptr<IOBuffer> drain_buf_; | 138 scoped_refptr<IOBuffer> drain_buf_; |
134 | 139 |
135 // Stores the underlying socket. | 140 // Stores the underlying socket. |
136 const scoped_ptr<ClientSocketHandle> transport_; | 141 const scoped_ptr<ClientSocketHandle> transport_; |
137 | 142 |
138 // 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 |
139 // 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. |
140 const HostPortPair endpoint_; | 145 const HostPortPair endpoint_; |
141 scoped_refptr<HttpAuthController> auth_; | 146 scoped_refptr<HttpAuthController> auth_; |
142 const bool tunnel_; | 147 const bool tunnel_; |
| 148 // If true, then the connection to the proxy is a SPDY connection. |
| 149 const bool using_spdy_; |
143 | 150 |
144 std::string request_headers_; | 151 std::string request_headers_; |
145 | 152 |
146 const BoundNetLog net_log_; | 153 const BoundNetLog net_log_; |
147 | 154 |
148 DISALLOW_COPY_AND_ASSIGN(HttpProxyClientSocket); | 155 DISALLOW_COPY_AND_ASSIGN(HttpProxyClientSocket); |
149 }; | 156 }; |
150 | 157 |
151 } // namespace net | 158 } // namespace net |
152 | 159 |
153 #endif // NET_HTTP_HTTP_PROXY_CLIENT_SOCKET_H_ | 160 #endif // NET_HTTP_HTTP_PROXY_CLIENT_SOCKET_H_ |
OLD | NEW |