| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 HttpAuthController* auth_controller) OVERRIDE; | 100 HttpAuthController* auth_controller) OVERRIDE; |
| 101 virtual void OnNeedsClientAuth(const SSLConfig& used_ssl_config, | 101 virtual void OnNeedsClientAuth(const SSLConfig& used_ssl_config, |
| 102 SSLCertRequestInfo* cert_info) OVERRIDE; | 102 SSLCertRequestInfo* cert_info) OVERRIDE; |
| 103 virtual void OnHttpsProxyTunnelResponse(const HttpResponseInfo& response_info, | 103 virtual void OnHttpsProxyTunnelResponse(const HttpResponseInfo& response_info, |
| 104 const SSLConfig& used_ssl_config, | 104 const SSLConfig& used_ssl_config, |
| 105 const ProxyInfo& used_proxy_info, | 105 const ProxyInfo& used_proxy_info, |
| 106 HttpStreamBase* stream) OVERRIDE; | 106 HttpStreamBase* stream) OVERRIDE; |
| 107 | 107 |
| 108 private: | 108 private: |
| 109 friend class HttpNetworkTransactionSSLTest; | 109 friend class HttpNetworkTransactionSSLTest; |
| 110 class HttpStreamHash; |
| 110 | 111 |
| 111 FRIEND_TEST_ALL_PREFIXES(HttpNetworkTransactionTest, | 112 FRIEND_TEST_ALL_PREFIXES(HttpNetworkTransactionTest, |
| 112 ResetStateForRestart); | 113 ResetStateForRestart); |
| 113 FRIEND_TEST_ALL_PREFIXES(SpdyNetworkTransactionTest, | 114 FRIEND_TEST_ALL_PREFIXES(SpdyNetworkTransactionTest, |
| 114 WindowUpdateReceived); | 115 WindowUpdateReceived); |
| 115 FRIEND_TEST_ALL_PREFIXES(SpdyNetworkTransactionTest, | 116 FRIEND_TEST_ALL_PREFIXES(SpdyNetworkTransactionTest, |
| 116 WindowUpdateSent); | 117 WindowUpdateSent); |
| 117 FRIEND_TEST_ALL_PREFIXES(SpdyNetworkTransactionTest, | 118 FRIEND_TEST_ALL_PREFIXES(SpdyNetworkTransactionTest, |
| 118 WindowUpdateOverflow); | 119 WindowUpdateOverflow); |
| 119 FRIEND_TEST_ALL_PREFIXES(SpdyNetworkTransactionTest, | 120 FRIEND_TEST_ALL_PREFIXES(SpdyNetworkTransactionTest, |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 int DoDrainBodyForAuthRestartComplete(int result); | 184 int DoDrainBodyForAuthRestartComplete(int result); |
| 184 | 185 |
| 185 void BuildRequestHeaders(bool using_proxy); | 186 void BuildRequestHeaders(bool using_proxy); |
| 186 | 187 |
| 187 // Record histogram of time until first byte of header is received. | 188 // Record histogram of time until first byte of header is received. |
| 188 void LogTransactionConnectedMetrics(); | 189 void LogTransactionConnectedMetrics(); |
| 189 | 190 |
| 190 // Record histogram of latency (durations until last byte received). | 191 // Record histogram of latency (durations until last byte received). |
| 191 void LogTransactionMetrics() const; | 192 void LogTransactionMetrics() const; |
| 192 | 193 |
| 194 // Record histogram of retry attempt success rate. |
| 195 void LogTransactionRetryMetrics(int error) const; |
| 196 |
| 193 // Writes a log message to help debugging in the field when we block a proxy | 197 // Writes a log message to help debugging in the field when we block a proxy |
| 194 // response to a CONNECT request. | 198 // response to a CONNECT request. |
| 195 void LogBlockedTunnelResponse(int response_code) const; | 199 void LogBlockedTunnelResponse(int response_code) const; |
| 196 | 200 |
| 197 // Called to handle a client certificate request. | 201 // Called to handle a client certificate request. |
| 198 int HandleCertificateRequest(int error); | 202 int HandleCertificateRequest(int error); |
| 199 | 203 |
| 200 // Called to possibly handle a client authentication error. | 204 // Called to possibly handle a client authentication error. |
| 201 void HandleClientAuthError(int error); | 205 void HandleClientAuthError(int error); |
| 202 | 206 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 // page just a few hundred bytes long. | 313 // page just a few hundred bytes long. |
| 310 static const int kDrainBodyBufferSize = 1024; | 314 static const int kDrainBodyBufferSize = 1024; |
| 311 | 315 |
| 312 // User buffer and length passed to the Read method. | 316 // User buffer and length passed to the Read method. |
| 313 scoped_refptr<IOBuffer> read_buf_; | 317 scoped_refptr<IOBuffer> read_buf_; |
| 314 int read_buf_len_; | 318 int read_buf_len_; |
| 315 | 319 |
| 316 // Total number of bytes received on streams for this transaction. | 320 // Total number of bytes received on streams for this transaction. |
| 317 int64 total_received_bytes_; | 321 int64 total_received_bytes_; |
| 318 | 322 |
| 323 // Total number of retries for this transaction. |
| 324 int retry_attempt_; |
| 325 |
| 326 // How much data was read from a response body before retrying a transaction. |
| 327 int64 offset_; |
| 328 |
| 329 // Previous content length, used for retry. |
| 330 int64 previous_content_length_; |
| 331 |
| 332 int64 received_body_length_; |
| 333 |
| 334 // Previous etag, used for retry. |
| 335 std::string previous_etag_; |
| 336 |
| 337 // Previous last modified, used for retry. |
| 338 std::string previous_last_modified_; |
| 339 |
| 340 // Hash of previous request attempt for cross-checking when retrying without |
| 341 // range support. |
| 342 scoped_ptr<HttpStreamHash> stream_hash_; |
| 343 |
| 319 // The time the Start method was called. | 344 // The time the Start method was called. |
| 320 base::Time start_time_; | 345 base::Time start_time_; |
| 321 | 346 |
| 322 // When the transaction started / finished sending the request, including | 347 // When the transaction started / finished sending the request, including |
| 323 // the body, if present. | 348 // the body, if present. |
| 324 base::TimeTicks send_start_time_; | 349 base::TimeTicks send_start_time_; |
| 325 base::TimeTicks send_end_time_; | 350 base::TimeTicks send_end_time_; |
| 326 | 351 |
| 327 // The next state in the state machine. | 352 // The next state in the state machine. |
| 328 State next_state_; | 353 State next_state_; |
| 329 | 354 |
| 330 // True when the tunnel is in the process of being established - we can't | 355 // True when the tunnel is in the process of being established - we can't |
| 331 // read from the socket until the tunnel is done. | 356 // read from the socket until the tunnel is done. |
| 332 bool establishing_tunnel_; | 357 bool establishing_tunnel_; |
| 333 | 358 |
| 334 // The helper object to use to create WebSocketHandshakeStreamBase | 359 // The helper object to use to create WebSocketHandshakeStreamBase |
| 335 // objects. Only relevant when establishing a WebSocket connection. | 360 // objects. Only relevant when establishing a WebSocket connection. |
| 336 WebSocketHandshakeStreamBase::CreateHelper* | 361 WebSocketHandshakeStreamBase::CreateHelper* |
| 337 websocket_handshake_stream_base_create_helper_; | 362 websocket_handshake_stream_base_create_helper_; |
| 338 | 363 |
| 339 BeforeNetworkStartCallback before_network_start_callback_; | 364 BeforeNetworkStartCallback before_network_start_callback_; |
| 340 BeforeProxyHeadersSentCallback before_proxy_headers_sent_callback_; | 365 BeforeProxyHeadersSentCallback before_proxy_headers_sent_callback_; |
| 341 | 366 |
| 342 DISALLOW_COPY_AND_ASSIGN(HttpNetworkTransaction); | 367 DISALLOW_COPY_AND_ASSIGN(HttpNetworkTransaction); |
| 343 }; | 368 }; |
| 344 | 369 |
| 345 } // namespace net | 370 } // namespace net |
| 346 | 371 |
| 347 #endif // NET_HTTP_HTTP_NETWORK_TRANSACTION_H_ | 372 #endif // NET_HTTP_HTTP_NETWORK_TRANSACTION_H_ |
| OLD | NEW |