Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1257)

Side by Side Diff: net/http/http_network_transaction.h

Issue 403393003: HTTP retry support. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 int DoDrainBodyForAuthRestartComplete(int result); 183 int DoDrainBodyForAuthRestartComplete(int result);
184 184
185 void BuildRequestHeaders(bool using_proxy); 185 void BuildRequestHeaders(bool using_proxy);
186 186
187 // Record histogram of time until first byte of header is received. 187 // Record histogram of time until first byte of header is received.
188 void LogTransactionConnectedMetrics(); 188 void LogTransactionConnectedMetrics();
189 189
190 // Record histogram of latency (durations until last byte received). 190 // Record histogram of latency (durations until last byte received).
191 void LogTransactionMetrics() const; 191 void LogTransactionMetrics() const;
192 192
193 // Record histogram of retry attempt success rate.
194 void LogTransactionRetryMetrics(int error) const;
195
193 // Writes a log message to help debugging in the field when we block a proxy 196 // Writes a log message to help debugging in the field when we block a proxy
194 // response to a CONNECT request. 197 // response to a CONNECT request.
195 void LogBlockedTunnelResponse(int response_code) const; 198 void LogBlockedTunnelResponse(int response_code) const;
196 199
197 // Called to handle a client certificate request. 200 // Called to handle a client certificate request.
198 int HandleCertificateRequest(int error); 201 int HandleCertificateRequest(int error);
199 202
200 // Called to possibly handle a client authentication error. 203 // Called to possibly handle a client authentication error.
201 void HandleClientAuthError(int error); 204 void HandleClientAuthError(int error);
202 205
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 // page just a few hundred bytes long. 312 // page just a few hundred bytes long.
310 static const int kDrainBodyBufferSize = 1024; 313 static const int kDrainBodyBufferSize = 1024;
311 314
312 // User buffer and length passed to the Read method. 315 // User buffer and length passed to the Read method.
313 scoped_refptr<IOBuffer> read_buf_; 316 scoped_refptr<IOBuffer> read_buf_;
314 int read_buf_len_; 317 int read_buf_len_;
315 318
316 // Total number of bytes received on streams for this transaction. 319 // Total number of bytes received on streams for this transaction.
317 int64 total_received_bytes_; 320 int64 total_received_bytes_;
318 321
322 // Total number of retries for this transaction.
323 int retry_attempt_;
324
325 // How much data was read from a response body before retrying a transaction.
326 int64 offset_;
327
328 // Previous content length, used for retry.
329 int64 previous_content_length_;
330
331 // Previous etag, used for retry.
332 std::string previous_etag_;
333
334 // Previous last modified, used for retry.
335 std::string previous_last_modified_;
336
337 // Hash of previous request attempt for cross-checking when retrying without
338 // range support.
339 uint8 hash_[8];
340
319 // The time the Start method was called. 341 // The time the Start method was called.
320 base::Time start_time_; 342 base::Time start_time_;
321 343
322 // When the transaction started / finished sending the request, including 344 // When the transaction started / finished sending the request, including
323 // the body, if present. 345 // the body, if present.
324 base::TimeTicks send_start_time_; 346 base::TimeTicks send_start_time_;
325 base::TimeTicks send_end_time_; 347 base::TimeTicks send_end_time_;
326 348
327 // The next state in the state machine. 349 // The next state in the state machine.
328 State next_state_; 350 State next_state_;
329 351
330 // True when the tunnel is in the process of being established - we can't 352 // True when the tunnel is in the process of being established - we can't
331 // read from the socket until the tunnel is done. 353 // read from the socket until the tunnel is done.
332 bool establishing_tunnel_; 354 bool establishing_tunnel_;
333 355
334 // The helper object to use to create WebSocketHandshakeStreamBase 356 // The helper object to use to create WebSocketHandshakeStreamBase
335 // objects. Only relevant when establishing a WebSocket connection. 357 // objects. Only relevant when establishing a WebSocket connection.
336 WebSocketHandshakeStreamBase::CreateHelper* 358 WebSocketHandshakeStreamBase::CreateHelper*
337 websocket_handshake_stream_base_create_helper_; 359 websocket_handshake_stream_base_create_helper_;
338 360
339 BeforeNetworkStartCallback before_network_start_callback_; 361 BeforeNetworkStartCallback before_network_start_callback_;
340 BeforeProxyHeadersSentCallback before_proxy_headers_sent_callback_; 362 BeforeProxyHeadersSentCallback before_proxy_headers_sent_callback_;
341 363
342 DISALLOW_COPY_AND_ASSIGN(HttpNetworkTransaction); 364 DISALLOW_COPY_AND_ASSIGN(HttpNetworkTransaction);
343 }; 365 };
344 366
345 } // namespace net 367 } // namespace net
346 368
347 #endif // NET_HTTP_HTTP_NETWORK_TRANSACTION_H_ 369 #endif // NET_HTTP_HTTP_NETWORK_TRANSACTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698