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

Unified Diff: net/http/http_network_transaction.cc

Issue 7289006: Basic HTTP pipelining support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use linked_ptr Created 9 years, 2 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 side-by-side diff with in-line comments
Download patch
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)));
+ error = RestartAfterPipelineEviction();
willchan no longer on Chromium 2011/10/13 02:29:17 I think you can just use ResetConnectionAndRequest
James Simonsen 2011/10/13 19:29:57 Done.
+ 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();

Powered by Google App Engine
This is Rietveld 408576698