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

Unified Diff: mojo/services/network/http_connection_impl.cc

Issue 1129143005: Introduce Http{Request,Response} mojom structs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
Index: mojo/services/network/http_connection_impl.cc
diff --git a/mojo/services/network/http_connection_impl.cc b/mojo/services/network/http_connection_impl.cc
index 24fc7c5de90c326d88650910fba7aa99854bb8ae..8fece71a5f2ec326ff592e747f775eb333129223 100644
--- a/mojo/services/network/http_connection_impl.cc
+++ b/mojo/services/network/http_connection_impl.cc
@@ -82,11 +82,11 @@ class HttpConnectionImpl::SimpleDataPipeReader {
};
template <>
-struct TypeConverter<URLRequestPtr, net::HttpServerRequestInfo> {
- static URLRequestPtr Convert(const net::HttpServerRequestInfo& obj) {
- URLRequestPtr request(URLRequest::New());
- request->url = obj.path;
+struct TypeConverter<HttpRequestPtr, net::HttpServerRequestInfo> {
+ static HttpRequestPtr Convert(const net::HttpServerRequestInfo& obj) {
+ HttpRequestPtr request(HttpRequest::New());
request->method = obj.method;
+ request->url = obj.path;
request->headers.resize(obj.headers.size());
size_t index = 0;
for (const auto& item : obj.headers) {
@@ -103,7 +103,7 @@ struct TypeConverter<URLRequestPtr, net::HttpServerRequestInfo> {
options.element_num_bytes = 1;
options.capacity_num_bytes = num_bytes;
DataPipe data_pipe(options);
- request->body.push_back(data_pipe.consumer_handle.Pass());
+ request->body = data_pipe.consumer_handle.Pass();
MojoResult result =
WriteDataRaw(data_pipe.producer_handle.get(), obj.data.data(),
&num_bytes, MOJO_WRITE_DATA_FLAG_ALL_OR_NONE);
@@ -138,7 +138,7 @@ void HttpConnectionImpl::OnReceivedHttpRequest(
return;
delegate_->OnReceivedRequest(
- URLRequest::From(info), [this](URLResponsePtr response) {
+ HttpRequest::From(info), [this](HttpResponsePtr response) {
if (response->body.is_valid()) {
SimpleDataPipeReader* reader = new SimpleDataPipeReader;
response_body_readers_.insert(reader);
@@ -198,7 +198,7 @@ void HttpConnectionImpl::OnConnectionError() {
}
void HttpConnectionImpl::OnFinishedReadingResponseBody(
- URLResponsePtr response,
+ HttpResponsePtr response,
SimpleDataPipeReader* reader,
scoped_ptr<std::string> body) {
if (reader) {

Powered by Google App Engine
This is Rietveld 408576698