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

Unified Diff: net/http/http_pipelined_stream.cc

Issue 8591037: Implement Drain() on HttpPipelinedStream. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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_pipelined_stream.cc
diff --git a/net/http/http_pipelined_stream.cc b/net/http/http_pipelined_stream.cc
index 6b844a6210ddae7eb0f3ca8d16c29fe9d6c290af..b281f4f132d03fa4ec9e791eeaae3e20881d3fcd 100644
--- a/net/http/http_pipelined_stream.cc
+++ b/net/http/http_pipelined_stream.cc
@@ -10,6 +10,9 @@
#include "net/http/http_pipelined_connection_impl.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_util.h"
namespace net {
@@ -118,11 +121,18 @@ void HttpPipelinedStream::LogNumRttVsBytesMetrics() const {
// TODO(simonjam): I don't want to copy & paste this from http_basic_stream.
}
-void HttpPipelinedStream::Drain(HttpNetworkSession*) {
- // On errors, we already evict everything from the pipeline and close it.
- // TODO(simonjam): Consider trying to drain the pipeline in the same way that
- // HttpBasicStream does.
- delete this;
+void HttpPipelinedStream::Drain(HttpNetworkSession* session) {
willchan no longer on Chromium 2011/11/20 18:09:21 I sort of suspect we want to defer the actual drai
James Simonsen 2011/11/22 01:24:20 Done.
+ if (!CanFindEndOfResponse()) {
+ // TODO(simonjam): It may be faster to drain the entire pipeline and re-use
+ // the connection than to close it and start over.
mmenke 2011/11/18 15:45:38 nit: Think we don't need this TODO any more, unle
James Simonsen 2011/11/22 01:24:20 I want to be able to recover without calling Close
+ Close(true);
+ delete this;
+ return;
+ }
+ HttpResponseBodyDrainer* drainer = new HttpResponseBodyDrainer(this);
+ drainer->StartWithSize(session,
+ GetResponseInfo()->headers->GetContentLength());
mmenke 2011/11/18 15:45:38 Important: This doesn't work with chunked encodin
James Simonsen 2011/11/22 01:24:20 Thanks. Didn't know anything about chunked encodin
+ // |drainer| will delete itself when done.
}
const SSLConfig& HttpPipelinedStream::used_ssl_config() const {

Powered by Google App Engine
This is Rietveld 408576698