| 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_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 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 | 90 |
| 91 private: | 91 private: |
| 92 enum State { | 92 enum State { |
| 93 STATE_NONE, | 93 STATE_NONE, |
| 94 STATE_GENERATE_AUTH_TOKEN, | 94 STATE_GENERATE_AUTH_TOKEN, |
| 95 STATE_GENERATE_AUTH_TOKEN_COMPLETE, | 95 STATE_GENERATE_AUTH_TOKEN_COMPLETE, |
| 96 STATE_SEND_REQUEST, | 96 STATE_SEND_REQUEST, |
| 97 STATE_SEND_REQUEST_COMPLETE, | 97 STATE_SEND_REQUEST_COMPLETE, |
| 98 STATE_READ_HEADERS, | 98 STATE_READ_HEADERS, |
| 99 STATE_READ_HEADERS_COMPLETE, | 99 STATE_READ_HEADERS_COMPLETE, |
| 100 STATE_HANDLE_PROXY_AUTH_CHALLENGE, |
| 101 STATE_HANDLE_PROXY_AUTH_CHALLENGE_COMPLETE, |
| 100 STATE_DRAIN_BODY, | 102 STATE_DRAIN_BODY, |
| 101 STATE_DRAIN_BODY_COMPLETE, | 103 STATE_DRAIN_BODY_COMPLETE, |
| 102 STATE_TCP_RESTART, | 104 STATE_TCP_RESTART, |
| 103 STATE_TCP_RESTART_COMPLETE, | 105 STATE_TCP_RESTART_COMPLETE, |
| 104 STATE_DONE, | 106 STATE_DONE, |
| 105 }; | 107 }; |
| 106 | 108 |
| 107 // The size in bytes of the buffer we use to drain the response body that | 109 // The size in bytes of the buffer we use to drain the response body that |
| 108 // we want to throw away. The response body is typically a small error | 110 // we want to throw away. The response body is typically a small error |
| 109 // page just a few hundred bytes long. | 111 // page just a few hundred bytes long. |
| 110 static const int kDrainBodyBufferSize = 1024; | 112 static const int kDrainBodyBufferSize = 1024; |
| 111 | 113 |
| 112 int PrepareForAuthRestart(); | 114 int PrepareForAuthRestart(); |
| 113 int DidDrainBodyForAuthRestart(bool keep_alive); | 115 int DidDrainBodyForAuthRestart(bool keep_alive); |
| 114 | 116 |
| 115 void LogBlockedTunnelResponse() const; | 117 void LogBlockedTunnelResponse() const; |
| 116 | 118 |
| 117 void DoCallback(int result); | 119 void DoCallback(int result); |
| 118 void OnIOComplete(int result); | 120 void OnIOComplete(int result); |
| 119 | 121 |
| 120 int DoLoop(int last_io_result); | 122 int DoLoop(int last_io_result); |
| 121 int DoGenerateAuthToken(); | 123 int DoGenerateAuthToken(); |
| 122 int DoGenerateAuthTokenComplete(int result); | 124 int DoGenerateAuthTokenComplete(int result); |
| 123 int DoSendRequest(); | 125 int DoSendRequest(); |
| 124 int DoSendRequestComplete(int result); | 126 int DoSendRequestComplete(int result); |
| 125 int DoReadHeaders(); | 127 int DoReadHeaders(); |
| 126 int DoReadHeadersComplete(int result); | 128 int DoReadHeadersComplete(int result); |
| 129 int DoHandleProxyAuthChallenge(); |
| 130 int DoHandleProxyAuthChallengeComplete(int result); |
| 127 int DoDrainBody(); | 131 int DoDrainBody(); |
| 128 int DoDrainBodyComplete(int result); | 132 int DoDrainBodyComplete(int result); |
| 129 int DoTCPRestart(); | 133 int DoTCPRestart(); |
| 130 int DoTCPRestartComplete(int result); | 134 int DoTCPRestartComplete(int result); |
| 131 | 135 |
| 132 CompletionCallback io_callback_; | 136 CompletionCallback io_callback_; |
| 133 State next_state_; | 137 State next_state_; |
| 134 | 138 |
| 135 // Stores the callback to the layer above, called on completing Connect(). | 139 // Stores the callback to the layer above, called on completing Connect(). |
| 136 CompletionCallback user_callback_; | 140 CompletionCallback user_callback_; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 ProxyDelegate* proxy_delegate_; | 174 ProxyDelegate* proxy_delegate_; |
| 171 | 175 |
| 172 const BoundNetLog net_log_; | 176 const BoundNetLog net_log_; |
| 173 | 177 |
| 174 DISALLOW_COPY_AND_ASSIGN(HttpProxyClientSocket); | 178 DISALLOW_COPY_AND_ASSIGN(HttpProxyClientSocket); |
| 175 }; | 179 }; |
| 176 | 180 |
| 177 } // namespace net | 181 } // namespace net |
| 178 | 182 |
| 179 #endif // NET_HTTP_HTTP_PROXY_CLIENT_SOCKET_H_ | 183 #endif // NET_HTTP_HTTP_PROXY_CLIENT_SOCKET_H_ |
| OLD | NEW |