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

Side by Side Diff: net/http/http_basic_stream.cc

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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/http/http_basic_stream.h" 5 #include "net/http/http_basic_stream.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "net/http/http_request_info.h" 8 #include "net/http/http_request_info.h"
9 #include "net/http/http_response_body_drainer.h" 9 #include "net/http/http_response_body_drainer.h"
10 #include "net/http/http_response_info.h"
10 #include "net/http/http_stream_parser.h" 11 #include "net/http/http_stream_parser.h"
11 #include "net/socket/client_socket_handle.h" 12 #include "net/socket/client_socket_handle.h"
12 13
13 namespace net { 14 namespace net {
14 15
15 HttpBasicStream::HttpBasicStream(ClientSocketHandle* connection, 16 HttpBasicStream::HttpBasicStream(ClientSocketHandle* connection,
16 bool using_proxy) 17 bool using_proxy)
17 : state_(connection, using_proxy) {} 18 : state_(connection, using_proxy) {}
18 19
19 HttpBasicStream::~HttpBasicStream() {} 20 HttpBasicStream::~HttpBasicStream() {}
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 return false; 110 return false;
110 111
111 return state_.connection()->socket()->GetPeerAddress(endpoint) == OK; 112 return state_.connection()->socket()->GetPeerAddress(endpoint) == OK;
112 } 113 }
113 114
114 Error HttpBasicStream::GetSignedEKMForTokenBinding(crypto::ECPrivateKey* key, 115 Error HttpBasicStream::GetSignedEKMForTokenBinding(crypto::ECPrivateKey* key,
115 std::vector<uint8_t>* out) { 116 std::vector<uint8_t>* out) {
116 return parser()->GetSignedEKMForTokenBinding(key, out); 117 return parser()->GetSignedEKMForTokenBinding(key, out);
117 } 118 }
118 119
119 void HttpBasicStream::Drain(HttpNetworkSession* session) { 120 void HttpBasicStream::Drain(HttpNetworkSession* session,
120 HttpResponseBodyDrainer* drainer = new HttpResponseBodyDrainer(this); 121 scoped_ptr<HttpResponseInfo> response_info) {
122 HttpResponseBodyDrainer* drainer =
123 new HttpResponseBodyDrainer(this, std::move(response_info));
asanka 2016/05/13 15:19:52 The ownership semantics of the Drain() method are
mmenke 2016/05/20 21:50:02 On one hand, you're right about these ownership se
121 drainer->Start(session); 124 drainer->Start(session);
122 // |drainer| will delete itself. 125 // |drainer| will delete itself.
123 } 126 }
124 127
125 void HttpBasicStream::PopulateNetErrorDetails(NetErrorDetails* details) { 128 void HttpBasicStream::PopulateNetErrorDetails(NetErrorDetails* details) {
126 details->connection_info = HttpResponseInfo::CONNECTION_INFO_HTTP1; 129 details->connection_info = HttpResponseInfo::CONNECTION_INFO_HTTP1;
127 return; 130 return;
128 } 131 }
129 132
130 void HttpBasicStream::SetPriority(RequestPriority priority) { 133 void HttpBasicStream::SetPriority(RequestPriority priority) {
131 // TODO(akalin): Plumb this through to |connection_|. 134 // TODO(akalin): Plumb this through to |connection_|.
132 } 135 }
133 136
134 } // namespace net 137 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698