Return unique_ptr from CreateConnectResponseStream().
Return unique_ptr<HttpStream> instead of raw HttpStream pointer from
ProxyClientSocket::CreateConnectResponseStream() and its overrides.
Pass unique_ptr<HttpStream> instead of raw HttpStream pointer to:
* HttpStreamFactoryImpl::Job::OnHttpsProxyTunnelResponseCallback()
* HttpStreamFactoryImpl::Job::Delegate::OnHttpsProxyTunnelResponse()
* HttpStreamFactoryImpl::Request::OnHttpsProxyTunnelResponse()
* HttpStreamRequest::Delegate::OnHttpsProxyTunnelResponse()
and their overrides.
This not only solves the problem of
BidirectionalStream::OnHttpsProxyTunnelResponse() silenty leaking an
HttpStream instance, but also makes it more difficult to do the wrong
thing in the future.
Also add some includes, one explicit keyword, and remove one semicolon,
to make git cl lint happy.
BUG=722361
Change-Id: Ie01023c8e077fe691df9daaa2ad6158befd1dd44
Reviewed-on: https://chromium-review.googlesource.com/505394
Reviewed-by: Helen Li <[email protected]>
Commit-Queue: Bence Béky <[email protected]>
Cr-Commit-Position: refs/heads/master@{#472076}
diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc
index cc5e02e..e29b01d4 100644
--- a/net/http/http_network_transaction.cc
+++ b/net/http/http_network_transaction.cc
@@ -4,7 +4,6 @@
#include "net/http/http_network_transaction.h"
-#include <memory>
#include <set>
#include <utility>
#include <vector>
@@ -561,7 +560,7 @@
const HttpResponseInfo& response_info,
const SSLConfig& used_ssl_config,
const ProxyInfo& used_proxy_info,
- HttpStream* stream) {
+ std::unique_ptr<HttpStream> stream) {
DCHECK_EQ(STATE_CREATE_STREAM_COMPLETE, next_state_);
CopyConnectionAttemptsFromStreamRequest();
@@ -574,7 +573,7 @@
total_received_bytes_ += stream_->GetTotalReceivedBytes();
total_sent_bytes_ += stream_->GetTotalSentBytes();
}
- stream_.reset(stream);
+ stream_ = std::move(stream);
stream_request_.reset(); // we're done with the stream request
OnIOComplete(ERR_HTTPS_PROXY_TUNNEL_RESPONSE);
}