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

Unified Diff: net/http/http_stream_parser.cc

Issue 15829004: Update net/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: license twerk Created 7 years, 7 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
« no previous file with comments | « net/http/http_stream_factory_impl_unittest.cc ('k') | net/http/http_stream_parser_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_stream_parser.cc
diff --git a/net/http/http_stream_parser.cc b/net/http/http_stream_parser.cc
index 7b195e7f698f11abb120c7c93642bed5871935cb..17b5c6e3f9e08a86e3a5602c23d68e257fe0b79e 100644
--- a/net/http/http_stream_parser.cc
+++ b/net/http/http_stream_parser.cc
@@ -248,15 +248,15 @@ int HttpStreamParser::SendRequest(const std::string& request_line,
// We'll repurpose |request_headers_| to store the merged headers and
// body.
request_headers_ = new DrainableIOBuffer(
- merged_request_headers_and_body, merged_size);
+ merged_request_headers_and_body.get(), merged_size);
memcpy(request_headers_->data(), request.data(), request.size());
request_headers_->DidConsume(request.size());
size_t todo = request_->upload_data_stream->size();
while (todo) {
- int consumed = request_->upload_data_stream->Read(request_headers_, todo,
- CompletionCallback());
+ int consumed = request_->upload_data_stream
+ ->Read(request_headers_.get(), todo, CompletionCallback());
DCHECK_GT(consumed, 0); // Read() won't fail if not chunked.
request_headers_->DidConsume(consumed);
todo -= consumed;
@@ -278,8 +278,8 @@ int HttpStreamParser::SendRequest(const std::string& request_line,
// If we didn't merge the body with the headers, then |request_headers_|
// contains just the HTTP headers.
scoped_refptr<StringIOBuffer> headers_io_buf(new StringIOBuffer(request));
- request_headers_ = new DrainableIOBuffer(headers_io_buf,
- headers_io_buf->size());
+ request_headers_ =
+ new DrainableIOBuffer(headers_io_buf.get(), headers_io_buf->size());
}
result = DoLoop(OK);
@@ -422,9 +422,8 @@ int HttpStreamParser::DoSendHeaders(int result) {
if (bytes_remaining == request_headers_->size()) {
response_->request_time = base::Time::Now();
}
- result = connection_->socket()->Write(request_headers_,
- bytes_remaining,
- io_callback_);
+ result = connection_->socket()
+ ->Write(request_headers_.get(), bytes_remaining, io_callback_);
} else if (request_->upload_data_stream != NULL &&
(request_->upload_data_stream->is_chunked() ||
// !IsEOF() indicates that the body wasn't merged.
@@ -451,10 +450,10 @@ int HttpStreamParser::DoSendBody(int result) {
// Send the remaining data in the request body buffer.
request_body_send_buf_->DidConsume(result);
if (request_body_send_buf_->BytesRemaining() > 0) {
- return connection_->socket()->Write(
- request_body_send_buf_,
- request_body_send_buf_->BytesRemaining(),
- io_callback_);
+ return connection_->socket()
+ ->Write(request_body_send_buf_.get(),
+ request_body_send_buf_->BytesRemaining(),
+ io_callback_);
}
if (request_->upload_data_stream->is_chunked() && sent_last_chunk_) {
@@ -464,7 +463,7 @@ int HttpStreamParser::DoSendBody(int result) {
request_body_read_buf_->Clear();
io_state_ = STATE_SEND_REQUEST_READING_BODY;
- return request_->upload_data_stream->Read(request_body_read_buf_,
+ return request_->upload_data_stream->Read(request_body_read_buf_.get(),
request_body_read_buf_->capacity(),
io_callback_);
}
@@ -513,9 +512,8 @@ int HttpStreamParser::DoReadHeaders() {
// See if the user is passing in an IOBuffer with a NULL |data_|.
CHECK(read_buf_->data());
- return connection_->socket()->Read(read_buf_,
- read_buf_->RemainingCapacity(),
- io_callback_);
+ return connection_->socket()
+ ->Read(read_buf_.get(), read_buf_->RemainingCapacity(), io_callback_);
}
int HttpStreamParser::DoReadHeadersComplete(int result) {
@@ -650,8 +648,8 @@ int HttpStreamParser::DoReadBody() {
return 0;
DCHECK_EQ(0, read_buf_->offset());
- return connection_->socket()->Read(user_read_buf_, user_read_buf_len_,
- io_callback_);
+ return connection_->socket()
+ ->Read(user_read_buf_.get(), user_read_buf_len_, io_callback_);
}
int HttpStreamParser::DoReadBodyComplete(int result) {
@@ -795,25 +793,26 @@ int HttpStreamParser::DoParseResponseHeaders(int end_offset) {
// If they exist, and have distinct values, it's a potential response
// smuggling attack.
if (!headers->HasHeader("Transfer-Encoding")) {
- if (HeadersContainMultipleCopiesOfField(*headers, "Content-Length"))
+ if (HeadersContainMultipleCopiesOfField(*headers.get(), "Content-Length"))
return ERR_RESPONSE_HEADERS_MULTIPLE_CONTENT_LENGTH;
}
// Check for multiple Content-Disposition or Location headers. If they exist,
// it's also a potential response smuggling attack.
- if (HeadersContainMultipleCopiesOfField(*headers, "Content-Disposition"))
+ if (HeadersContainMultipleCopiesOfField(*headers.get(),
+ "Content-Disposition"))
return ERR_RESPONSE_HEADERS_MULTIPLE_CONTENT_DISPOSITION;
- if (HeadersContainMultipleCopiesOfField(*headers, "Location"))
+ if (HeadersContainMultipleCopiesOfField(*headers.get(), "Location"))
return ERR_RESPONSE_HEADERS_MULTIPLE_LOCATION;
response_->headers = headers;
response_->connection_info = HttpResponseInfo::CONNECTION_INFO_HTTP1;
- response_->vary_data.Init(*request_, *response_->headers);
+ response_->vary_data.Init(*request_, *response_->headers.get());
DVLOG(1) << __FUNCTION__ << "()"
- << " content_length = \""
- << response_->headers->GetContentLength() << "\n\""
- << " headers = \"" << GetResponseHeaderLines(*response_->headers)
- << "\"";
+ << " content_length = \"" << response_->headers->GetContentLength()
+ << "\n\""
+ << " headers = \""
+ << GetResponseHeaderLines(*response_->headers.get()) << "\"";
return OK;
}
« no previous file with comments | « net/http/http_stream_factory_impl_unittest.cc ('k') | net/http/http_stream_parser_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698