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

Unified Diff: net/http/http_basic_state.cc

Issue 2298823002: Resetting the HttpRequestInfo pointers in HttpNetworkTransaction and streams (Closed)
Patch Set: Initial patch Created 4 years, 4 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_basic_state.cc
diff --git a/net/http/http_basic_state.cc b/net/http/http_basic_state.cc
index ceadb5761eba00ff916a53972d5303e6f4030f96..113cfa9618b49ffc63436a69ded4a46cf2ae9687 100644
--- a/net/http/http_basic_state.cc
+++ b/net/http/http_basic_state.cc
@@ -21,8 +21,7 @@ HttpBasicState::HttpBasicState(std::unique_ptr<ClientSocketHandle> connection,
bool using_proxy)
: read_buf_(new GrowableIOBuffer()),
connection_(std::move(connection)),
- using_proxy_(using_proxy),
- request_info_(NULL) {}
+ using_proxy_(using_proxy) {}
HttpBasicState::~HttpBasicState() {}
@@ -31,7 +30,8 @@ int HttpBasicState::Initialize(const HttpRequestInfo* request_info,
const BoundNetLog& net_log,
const CompletionCallback& callback) {
DCHECK(!parser_.get());
- request_info_ = request_info;
+ url_ = request_info->url;
+ request_method_ = request_info->method;
parser_.reset(new HttpStreamParser(
connection_.get(), request_info, read_buf_.get(), net_log));
return OK;
@@ -50,16 +50,14 @@ void HttpBasicState::DeleteParser() { parser_.reset(); }
std::string HttpBasicState::GenerateRequestLine() const {
static const char kSuffix[] = " HTTP/1.1\r\n";
const size_t kSuffixLen = arraysize(kSuffix) - 1;
- DCHECK(request_info_);
- const GURL& url = request_info_->url;
const std::string path =
- using_proxy_ ? HttpUtil::SpecForRequest(url) : url.PathForRequest();
+ using_proxy_ ? HttpUtil::SpecForRequest(url_) : url_.PathForRequest();
// Don't use StringPrintf for concatenation because it is very inefficient.
std::string request_line;
- const size_t expected_size = request_info_->method.size() + 1 + path.size() +
- kSuffixLen;
+ const size_t expected_size =
+ request_method_.size() + 1 + path.size() + kSuffixLen;
request_line.reserve(expected_size);
- request_line.append(request_info_->method);
+ request_line.append(request_method_);
request_line.append(1, ' ');
request_line.append(path);
request_line.append(kSuffix, kSuffixLen);

Powered by Google App Engine
This is Rietveld 408576698