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 d1e7ec58ce8be7edcf9e90e220c5a878a6350ca5..f4218e8d7a53a72bc1adb3233ebaa6efdcae35a1 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_stream_factory.h" |
| @@ -135,15 +134,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_); |
| } |
| } |
| } |
| @@ -547,8 +539,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); |
|
willchan no longer on Chromium
2011/09/29 19:32:48
You should keep this back where it was.
James Simonsen
2011/10/12 01:36:58
Didn't mean to delete it. Forgot to save before up
|
| break; |
| case STATE_READ_BODY: |
| DCHECK_EQ(OK, rv); |
| @@ -872,6 +862,10 @@ int HttpNetworkTransaction::DoReadHeadersComplete(int result) { |
| if (is_https_request()) |
| stream_->GetSSLInfo(&response_.ssl_info); |
| + if (read_buf_len_) { |
| + next_state_ = STATE_READ_BODY; |
|
willchan no longer on Chromium
2011/09/29 19:32:48
I believe this is a bug. We should only transition
James Simonsen
2011/10/12 01:36:58
It's a tricky situation. Maybe I should just forge
willchan no longer on Chromium
2011/10/13 02:29:16
A new test? Because this shouldn't happen, since n
|
| + } |
| + |
| headers_valid_ = true; |
| return OK; |
| } |
| @@ -1186,6 +1180,10 @@ int HttpNetworkTransaction::HandleIOError(int error) { |
| error = HandleSSLHandshakeError(error); |
| switch (error) { |
| + case ERR_PIPELINE_EVICTION: |
|
willchan no longer on Chromium
2011/09/29 19:32:48
I think here you should log to net_log_. You shoul
James Simonsen
2011/10/12 01:36:58
Done.
|
| + 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 |
| @@ -1202,6 +1200,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(); |