Chromium Code Reviews| Index: net/http/http_network_transaction.cc |
| diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc |
| index 2e6a46c822de3e01ebde109bfa07fcfacfcb6aba..d178c30494c3bfcde079a2b9ffccb3d2374c6ae5 100644 |
| --- a/net/http/http_network_transaction.cc |
| +++ b/net/http/http_network_transaction.cc |
| @@ -39,7 +39,6 @@ |
| #include "net/http/http_proxy_client_socket_pool.h" |
| #include "net/http/http_request_headers.h" |
| #include "net/http/http_request_info.h" |
| -#include "net/http/http_response_body_drainer.h" |
| #include "net/http/http_response_headers.h" |
| #include "net/http/http_response_info.h" |
| #include "net/http/http_server_properties.h" |
| @@ -137,15 +136,8 @@ HttpNetworkTransaction::~HttpNetworkTransaction() { |
| stream_->Close(true /* not reusable */); |
| } else { |
| // Otherwise, we try to drain the response body. |
| - // TODO(willchan): Consider moving this response body draining to the |
| - // stream implementation. For SPDY, there's clearly no point. For |
| - // HTTP, it can vary depending on whether or not we're pipelining. It's |
| - // stream dependent, so the different subtypes should be implementing |
| - // their solutions. |
| - HttpResponseBodyDrainer* drainer = |
| - new HttpResponseBodyDrainer(stream_.release()); |
| - drainer->Start(session_); |
| - // |drainer| will delete itself. |
| + HttpStream* stream = stream_.release(); |
| + stream->Drain(session_); |
| } |
| } |
| } |
| @@ -551,8 +543,6 @@ int HttpNetworkTransaction::DoLoop(int result) { |
| break; |
| case STATE_READ_HEADERS_COMPLETE: |
| rv = DoReadHeadersComplete(rv); |
| - net_log_.EndEventWithNetErrorCode( |
| - NetLog::TYPE_HTTP_TRANSACTION_READ_HEADERS, rv); |
| break; |
| case STATE_READ_BODY: |
| DCHECK_EQ(OK, rv); |
| @@ -1190,6 +1180,13 @@ int HttpNetworkTransaction::HandleIOError(int error) { |
| error = HandleSSLHandshakeError(error); |
| switch (error) { |
| + case ERR_PIPELINE_EVICTION: |
| + net_log_.AddEvent( |
| + NetLog::TYPE_HTTP_TRANSACTION_RESTART_AFTER_ERROR, |
| + make_scoped_refptr(new NetLogIntegerParameter("net_error", error))); |
|
mmenke
2011/10/12 19:41:35
nit: I have a CL under review which lets you just
James Simonsen
2011/10/12 21:55:51
Nice. Will switch when it's ready.
mmenke
2011/10/13 03:02:48
No need to hold off committing on this. Haven't h
|
| + error = RestartAfterPipelineEviction(); |
| + break; |
| + |
| // If we try to reuse a connection that the server is in the process of |
| // closing, we may end up successfully writing out our request (or a |
| // portion of our request) only to find a connection error when we try to |
| @@ -1198,6 +1195,9 @@ int HttpNetworkTransaction::HandleIOError(int error) { |
| case ERR_CONNECTION_CLOSED: |
| case ERR_CONNECTION_ABORTED: |
| if (ShouldResendRequest(error)) { |
| + net_log_.AddEvent( |
| + NetLog::TYPE_HTTP_TRANSACTION_RESTART_AFTER_ERROR, |
| + make_scoped_refptr(new NetLogIntegerParameter("net_error", error))); |
| ResetConnectionAndRequestForResend(); |
| error = OK; |
| } |
| @@ -1206,6 +1206,14 @@ int HttpNetworkTransaction::HandleIOError(int error) { |
| return error; |
| } |
| +int HttpNetworkTransaction::RestartAfterPipelineEviction() { |
| + stream_->Close(true); |
| + stream_.reset(); |
| + stream_request_.reset(); |
| + next_state_ = STATE_CREATE_STREAM; |
| + return OK; |
| +} |
| + |
| void HttpNetworkTransaction::ResetStateForRestart() { |
| ResetStateForAuthRestart(); |
| stream_.reset(); |