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

Unified Diff: net/http/http_stream.h

Issue 1884943003: HttpStreamParser: Don't reuse sockets which receive unparsed data. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix drainer test ('True' means closed...) Created 4 years, 8 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_stream.h
diff --git a/net/http/http_stream.h b/net/http/http_stream.h
index 096dd462299b72987f215b9d7f0ff96c9b622f2c..5a4fe9b8d5463fe608f4e1fa387d526d7a8f4412 100644
--- a/net/http/http_stream.h
+++ b/net/http/http_stream.h
@@ -64,9 +64,13 @@ class NET_EXPORT_PRIVATE HttpStream {
// set of headers, and is safe to read, until/unless ReadResponseHeaders is
// called.
//
- // |response| must remain valid until all sets of headers has been read, or
- // the HttpStream is destroyed. There's typically only one set of
- // headers, except in the case of 1xx responses (See ReadResponseHeaders).
+ // |response| must remain valid for the lifetime of the stream. There's
+ // typically only one set of headers, except in the case of 1xx responses (See
+ // ReadResponseHeaders).
+ // TODO(mmenke): |response|'s lifetime and ownership models are somewhat
+ // bonkers, particularly considering HttpNetworkTransaction can clobber
+ // it. Can something better be done, preferably without keeping multiple
+ // copies of the struct around?
virtual int SendRequest(const HttpRequestHeaders& request_headers,
HttpResponseInfo* response,
const CompletionCallback& callback) = 0;
@@ -167,7 +171,8 @@ class NET_EXPORT_PRIVATE HttpStream {
// a simple error or "this page has moved") so that we can re-use the
// underlying connection. This stream is responsible for deleting itself when
// draining is complete.
- virtual void Drain(HttpNetworkSession* session) = 0;
+ virtual void Drain(HttpNetworkSession* session,
+ scoped_ptr<HttpResponseInfo> response_info) = 0;
asanka 2016/05/13 15:19:52 Should document here that |response_info| *must* b
mmenke 2016/05/20 21:50:02 The more I looked at this, the less I liked it. I
// Get the network error details this stream is encountering.
// Fills in |details| if it is available; leaves |details| unchanged if it

Powered by Google App Engine
This is Rietveld 408576698