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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 bool is_https_proxy); | 49 bool is_https_proxy); |
50 | 50 |
51 // On destruction Disconnect() is called. | 51 // On destruction Disconnect() is called. |
52 virtual ~HttpProxyClientSocket(); | 52 virtual ~HttpProxyClientSocket(); |
53 | 53 |
54 // If Connect (or its callback) returns PROXY_AUTH_REQUESTED, then | 54 // If Connect (or its callback) returns PROXY_AUTH_REQUESTED, then |
55 // credentials should be added to the HttpAuthController before calling | 55 // credentials should be added to the HttpAuthController before calling |
56 // RestartWithAuth. | 56 // RestartWithAuth. |
57 int RestartWithAuth(CompletionCallback* callback); | 57 int RestartWithAuth(CompletionCallback* callback); |
58 | 58 |
59 const HttpResponseInfo* GetConnectResponseInfo() const { | |
60 return response_.headers ? &response_ : NULL; | |
61 } | |
62 | |
63 virtual HttpStream* CreateConnectResponseStream(); | |
64 | |
65 const scoped_refptr<HttpAuthController>& auth_controller() { | 59 const scoped_refptr<HttpAuthController>& auth_controller() { |
66 return auth_; | 60 return auth_; |
67 } | 61 } |
68 | 62 |
69 bool using_spdy() { | 63 bool using_spdy() { |
70 return using_spdy_; | 64 return using_spdy_; |
71 } | 65 } |
72 | 66 |
| 67 // ProxyClientSocket methods: |
| 68 virtual const HttpResponseInfo* GetConnectResponseInfo() const; |
| 69 virtual HttpStream* CreateConnectResponseStream(); |
| 70 |
73 // ClientSocket methods: | 71 // ClientSocket methods: |
74 | |
75 // Authenticates to the Http Proxy and then passes data freely. | |
76 virtual int Connect(CompletionCallback* callback); | 72 virtual int Connect(CompletionCallback* callback); |
77 virtual void Disconnect(); | 73 virtual void Disconnect(); |
78 virtual bool IsConnected() const; | 74 virtual bool IsConnected() const; |
79 virtual bool IsConnectedAndIdle() const; | 75 virtual bool IsConnectedAndIdle() const; |
80 virtual const BoundNetLog& NetLog() const; | 76 virtual const BoundNetLog& NetLog() const; |
81 virtual void SetSubresourceSpeculation(); | 77 virtual void SetSubresourceSpeculation(); |
82 virtual void SetOmniboxSpeculation(); | 78 virtual void SetOmniboxSpeculation(); |
83 virtual bool WasEverUsed() const; | 79 virtual bool WasEverUsed() const; |
84 virtual bool UsingTCPFastOpen() const; | 80 virtual bool UsingTCPFastOpen() const; |
85 | 81 |
86 // Socket methods: | 82 // Socket methods: |
87 virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback); | 83 virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback); |
88 virtual int Write(IOBuffer* buf, int buf_len, CompletionCallback* callback); | 84 virtual int Write(IOBuffer* buf, int buf_len, CompletionCallback* callback); |
89 | |
90 virtual bool SetReceiveBufferSize(int32 size); | 85 virtual bool SetReceiveBufferSize(int32 size); |
91 virtual bool SetSendBufferSize(int32 size); | 86 virtual bool SetSendBufferSize(int32 size); |
92 | |
93 virtual int GetPeerAddress(AddressList* address) const; | 87 virtual int GetPeerAddress(AddressList* address) const; |
94 | 88 |
95 private: | 89 private: |
96 enum State { | 90 enum State { |
97 STATE_NONE, | 91 STATE_NONE, |
98 STATE_GENERATE_AUTH_TOKEN, | 92 STATE_GENERATE_AUTH_TOKEN, |
99 STATE_GENERATE_AUTH_TOKEN_COMPLETE, | 93 STATE_GENERATE_AUTH_TOKEN_COMPLETE, |
100 STATE_SEND_REQUEST, | 94 STATE_SEND_REQUEST, |
101 STATE_SEND_REQUEST_COMPLETE, | 95 STATE_SEND_REQUEST_COMPLETE, |
102 STATE_READ_HEADERS, | 96 STATE_READ_HEADERS, |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 HttpRequestHeaders request_headers_; | 159 HttpRequestHeaders request_headers_; |
166 | 160 |
167 const BoundNetLog net_log_; | 161 const BoundNetLog net_log_; |
168 | 162 |
169 DISALLOW_COPY_AND_ASSIGN(HttpProxyClientSocket); | 163 DISALLOW_COPY_AND_ASSIGN(HttpProxyClientSocket); |
170 }; | 164 }; |
171 | 165 |
172 } // namespace net | 166 } // namespace net |
173 | 167 |
174 #endif // NET_HTTP_HTTP_PROXY_CLIENT_SOCKET_H_ | 168 #endif // NET_HTTP_HTTP_PROXY_CLIENT_SOCKET_H_ |
OLD | NEW |