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_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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 int DoSendRequestComplete(int result); | 171 int DoSendRequestComplete(int result); |
172 int DoReadHeaders(); | 172 int DoReadHeaders(); |
173 int DoReadHeadersComplete(int result); | 173 int DoReadHeadersComplete(int result); |
174 int DoReadBody(); | 174 int DoReadBody(); |
175 int DoReadBodyComplete(int result); | 175 int DoReadBodyComplete(int result); |
176 int DoDrainBodyForAuthRestart(); | 176 int DoDrainBodyForAuthRestart(); |
177 int DoDrainBodyForAuthRestartComplete(int result); | 177 int DoDrainBodyForAuthRestartComplete(int result); |
178 | 178 |
179 void BuildRequestHeaders(bool using_proxy); | 179 void BuildRequestHeaders(bool using_proxy); |
180 | 180 |
181 // Record histogram of time until first byte of header is received. | |
182 void LogTransactionConnectedMetrics(); | |
183 | |
184 // Record histogram of latency (durations until last byte received). | |
185 void LogTransactionMetrics() const; | |
186 | |
187 // Writes a log message to help debugging in the field when we block a proxy | 181 // Writes a log message to help debugging in the field when we block a proxy |
188 // response to a CONNECT request. | 182 // response to a CONNECT request. |
189 void LogBlockedTunnelResponse(int response_code) const; | 183 void LogBlockedTunnelResponse(int response_code) const; |
190 | 184 |
191 // Called to handle a client certificate request. | 185 // Called to handle a client certificate request. |
192 int HandleCertificateRequest(int error); | 186 int HandleCertificateRequest(int error); |
193 | 187 |
194 // Called to possibly handle a client authentication error. | 188 // Called to possibly handle a client authentication error. |
195 void HandleClientAuthError(int error); | 189 void HandleClientAuthError(int error); |
196 | 190 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 | 269 |
276 // |proxy_info_| is the ProxyInfo used by the HttpStreamRequest. | 270 // |proxy_info_| is the ProxyInfo used by the HttpStreamRequest. |
277 ProxyInfo proxy_info_; | 271 ProxyInfo proxy_info_; |
278 | 272 |
279 scoped_ptr<HttpStreamRequest> stream_request_; | 273 scoped_ptr<HttpStreamRequest> stream_request_; |
280 scoped_ptr<HttpStreamBase> stream_; | 274 scoped_ptr<HttpStreamBase> stream_; |
281 | 275 |
282 // True if we've validated the headers that the stream parser has returned. | 276 // True if we've validated the headers that the stream parser has returned. |
283 bool headers_valid_; | 277 bool headers_valid_; |
284 | 278 |
285 // True if we've logged the time of the first response byte. Used to | |
286 // prevent logging across authentication activity where we see multiple | |
287 // responses. | |
288 bool logged_response_time_; | |
289 | |
290 SSLConfig server_ssl_config_; | 279 SSLConfig server_ssl_config_; |
291 SSLConfig proxy_ssl_config_; | 280 SSLConfig proxy_ssl_config_; |
292 // fallback_error_code contains the error code that caused the last TLS | 281 // fallback_error_code contains the error code that caused the last TLS |
293 // fallback. If the fallback connection results in | 282 // fallback. If the fallback connection results in |
294 // ERR_SSL_INAPPROPRIATE_FALLBACK (i.e. the server indicated that the | 283 // ERR_SSL_INAPPROPRIATE_FALLBACK (i.e. the server indicated that the |
295 // fallback should not have been needed) then we use this value to return the | 284 // fallback should not have been needed) then we use this value to return the |
296 // original error that triggered the fallback. | 285 // original error that triggered the fallback. |
297 int fallback_error_code_; | 286 int fallback_error_code_; |
298 | 287 |
299 HttpRequestHeaders request_headers_; | 288 HttpRequestHeaders request_headers_; |
300 | 289 |
301 // The size in bytes of the buffer we use to drain the response body that | 290 // The size in bytes of the buffer we use to drain the response body that |
302 // we want to throw away. The response body is typically a small error | 291 // we want to throw away. The response body is typically a small error |
303 // page just a few hundred bytes long. | 292 // page just a few hundred bytes long. |
304 static const int kDrainBodyBufferSize = 1024; | 293 static const int kDrainBodyBufferSize = 1024; |
305 | 294 |
306 // User buffer and length passed to the Read method. | 295 // User buffer and length passed to the Read method. |
307 scoped_refptr<IOBuffer> read_buf_; | 296 scoped_refptr<IOBuffer> read_buf_; |
308 int read_buf_len_; | 297 int read_buf_len_; |
309 | 298 |
310 // Total number of bytes received on streams for this transaction. | 299 // Total number of bytes received on streams for this transaction. |
311 int64 total_received_bytes_; | 300 int64 total_received_bytes_; |
312 | 301 |
313 // The time the Start method was called. | |
314 base::Time start_time_; | |
315 | |
316 // When the transaction started / finished sending the request, including | 302 // When the transaction started / finished sending the request, including |
317 // the body, if present. | 303 // the body, if present. |
318 base::TimeTicks send_start_time_; | 304 base::TimeTicks send_start_time_; |
319 base::TimeTicks send_end_time_; | 305 base::TimeTicks send_end_time_; |
320 | 306 |
321 // The next state in the state machine. | 307 // The next state in the state machine. |
322 State next_state_; | 308 State next_state_; |
323 | 309 |
324 // True when the tunnel is in the process of being established - we can't | 310 // True when the tunnel is in the process of being established - we can't |
325 // read from the socket until the tunnel is done. | 311 // read from the socket until the tunnel is done. |
326 bool establishing_tunnel_; | 312 bool establishing_tunnel_; |
327 | 313 |
328 // The helper object to use to create WebSocketHandshakeStreamBase | 314 // The helper object to use to create WebSocketHandshakeStreamBase |
329 // objects. Only relevant when establishing a WebSocket connection. | 315 // objects. Only relevant when establishing a WebSocket connection. |
330 WebSocketHandshakeStreamBase::CreateHelper* | 316 WebSocketHandshakeStreamBase::CreateHelper* |
331 websocket_handshake_stream_base_create_helper_; | 317 websocket_handshake_stream_base_create_helper_; |
332 | 318 |
333 BeforeNetworkStartCallback before_network_start_callback_; | 319 BeforeNetworkStartCallback before_network_start_callback_; |
334 BeforeProxyHeadersSentCallback before_proxy_headers_sent_callback_; | 320 BeforeProxyHeadersSentCallback before_proxy_headers_sent_callback_; |
335 | 321 |
336 DISALLOW_COPY_AND_ASSIGN(HttpNetworkTransaction); | 322 DISALLOW_COPY_AND_ASSIGN(HttpNetworkTransaction); |
337 }; | 323 }; |
338 | 324 |
339 } // namespace net | 325 } // namespace net |
340 | 326 |
341 #endif // NET_HTTP_HTTP_NETWORK_TRANSACTION_H_ | 327 #endif // NET_HTTP_HTTP_NETWORK_TRANSACTION_H_ |
OLD | NEW |