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_NETWORK_TRANSACTION_H_ | 5 #ifndef NET_HTTP_HTTP_NETWORK_TRANSACTION_H_ |
6 #define NET_HTTP_HTTP_NETWORK_TRANSACTION_H_ | 6 #define NET_HTTP_HTTP_NETWORK_TRANSACTION_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 virtual uint64 GetUploadProgress() const; | 76 virtual uint64 GetUploadProgress() const; |
77 | 77 |
78 private: | 78 private: |
79 FRIEND_TEST(HttpNetworkTransactionTest, ResetStateForRestart); | 79 FRIEND_TEST(HttpNetworkTransactionTest, ResetStateForRestart); |
80 | 80 |
81 enum State { | 81 enum State { |
82 STATE_RESOLVE_PROXY, | 82 STATE_RESOLVE_PROXY, |
83 STATE_RESOLVE_PROXY_COMPLETE, | 83 STATE_RESOLVE_PROXY_COMPLETE, |
84 STATE_INIT_CONNECTION, | 84 STATE_INIT_CONNECTION, |
85 STATE_INIT_CONNECTION_COMPLETE, | 85 STATE_INIT_CONNECTION_COMPLETE, |
| 86 STATE_RESTART_TUNNEL_AUTH, |
| 87 STATE_RESTART_TUNNEL_AUTH_COMPLETE, |
86 STATE_GENERATE_PROXY_AUTH_TOKEN, | 88 STATE_GENERATE_PROXY_AUTH_TOKEN, |
87 STATE_GENERATE_PROXY_AUTH_TOKEN_COMPLETE, | 89 STATE_GENERATE_PROXY_AUTH_TOKEN_COMPLETE, |
88 STATE_GENERATE_SERVER_AUTH_TOKEN, | 90 STATE_GENERATE_SERVER_AUTH_TOKEN, |
89 STATE_GENERATE_SERVER_AUTH_TOKEN_COMPLETE, | 91 STATE_GENERATE_SERVER_AUTH_TOKEN_COMPLETE, |
90 STATE_SEND_REQUEST, | 92 STATE_SEND_REQUEST, |
91 STATE_SEND_REQUEST_COMPLETE, | 93 STATE_SEND_REQUEST_COMPLETE, |
92 STATE_READ_HEADERS, | 94 STATE_READ_HEADERS, |
93 STATE_READ_HEADERS_COMPLETE, | 95 STATE_READ_HEADERS_COMPLETE, |
94 STATE_READ_BODY, | 96 STATE_READ_BODY, |
95 STATE_READ_BODY_COMPLETE, | 97 STATE_READ_BODY_COMPLETE, |
(...skipping 23 matching lines...) Expand all Loading... |
119 int DoLoop(int result); | 121 int DoLoop(int result); |
120 | 122 |
121 // Each of these methods corresponds to a State value. Those with an input | 123 // Each of these methods corresponds to a State value. Those with an input |
122 // argument receive the result from the previous state. If a method returns | 124 // argument receive the result from the previous state. If a method returns |
123 // ERR_IO_PENDING, then the result from OnIOComplete will be passed to the | 125 // ERR_IO_PENDING, then the result from OnIOComplete will be passed to the |
124 // next state method as the result arg. | 126 // next state method as the result arg. |
125 int DoResolveProxy(); | 127 int DoResolveProxy(); |
126 int DoResolveProxyComplete(int result); | 128 int DoResolveProxyComplete(int result); |
127 int DoInitConnection(); | 129 int DoInitConnection(); |
128 int DoInitConnectionComplete(int result); | 130 int DoInitConnectionComplete(int result); |
| 131 int DoRestartTunnelAuth(); |
| 132 int DoRestartTunnelAuthComplete(int result); |
129 int DoGenerateProxyAuthToken(); | 133 int DoGenerateProxyAuthToken(); |
130 int DoGenerateProxyAuthTokenComplete(int result); | 134 int DoGenerateProxyAuthTokenComplete(int result); |
131 int DoGenerateServerAuthToken(); | 135 int DoGenerateServerAuthToken(); |
132 int DoGenerateServerAuthTokenComplete(int result); | 136 int DoGenerateServerAuthTokenComplete(int result); |
133 int DoSendRequest(); | 137 int DoSendRequest(); |
134 int DoSendRequestComplete(int result); | 138 int DoSendRequestComplete(int result); |
135 int DoReadHeaders(); | 139 int DoReadHeaders(); |
136 int DoReadHeadersComplete(int result); | 140 int DoReadHeadersComplete(int result); |
137 int DoReadBody(); | 141 int DoReadBody(); |
138 int DoReadBodyComplete(int result); | 142 int DoReadBodyComplete(int result); |
(...skipping 16 matching lines...) Expand all Loading... |
155 | 159 |
156 // Record histogram of latency (durations until last byte received). | 160 // Record histogram of latency (durations until last byte received). |
157 void LogTransactionMetrics() const; | 161 void LogTransactionMetrics() const; |
158 | 162 |
159 // Writes a log message to help debugging in the field when we block a proxy | 163 // Writes a log message to help debugging in the field when we block a proxy |
160 // response to a CONNECT request. | 164 // response to a CONNECT request. |
161 void LogBlockedTunnelResponse(int response_code) const; | 165 void LogBlockedTunnelResponse(int response_code) const; |
162 | 166 |
163 static void LogIOErrorMetrics(const ClientSocketHandle& handle); | 167 static void LogIOErrorMetrics(const ClientSocketHandle& handle); |
164 | 168 |
| 169 // Called to handle an HTTP proxy tunnel request for auth. |
| 170 int HandleTunnelAuthFailure(int error); |
| 171 |
165 // Called to handle a certificate error. Returns OK if the error should be | 172 // Called to handle a certificate error. Returns OK if the error should be |
166 // ignored. Otherwise, stores the certificate in response_.ssl_info and | 173 // ignored. Otherwise, stores the certificate in response_.ssl_info and |
167 // returns the same error code. | 174 // returns the same error code. |
168 int HandleCertificateError(int error); | 175 int HandleCertificateError(int error); |
169 | 176 |
170 // Called to handle a client certificate request. | 177 // Called to handle a client certificate request. |
171 int HandleCertificateRequest(int error); | 178 int HandleCertificateRequest(int error); |
172 | 179 |
173 // Called to possibly recover from an SSL handshake error. Sets next_state_ | 180 // Called to possibly recover from an SSL handshake error. Sets next_state_ |
174 // and returns OK if recovering from the error. Otherwise, the same error | 181 // and returns OK if recovering from the error. Otherwise, the same error |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 // True when the tunnel is in the process of being established - we can't | 320 // True when the tunnel is in the process of being established - we can't |
314 // read from the socket until the tunnel is done. | 321 // read from the socket until the tunnel is done. |
315 bool establishing_tunnel_; | 322 bool establishing_tunnel_; |
316 | 323 |
317 DISALLOW_COPY_AND_ASSIGN(HttpNetworkTransaction); | 324 DISALLOW_COPY_AND_ASSIGN(HttpNetworkTransaction); |
318 }; | 325 }; |
319 | 326 |
320 } // namespace net | 327 } // namespace net |
321 | 328 |
322 #endif // NET_HTTP_HTTP_NETWORK_TRANSACTION_H_ | 329 #endif // NET_HTTP_HTTP_NETWORK_TRANSACTION_H_ |
OLD | NEW |