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

Unified Diff: examples/http_handler/http_handler.cc

Issue 953513002: http_server: accept full NetAddress in CreateHttpServer. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Address Ben's comments. Created 5 years, 10 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 | « examples/http_handler/BUILD.gn ('k') | services/http_server/http_server_apptest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: examples/http_handler/http_handler.cc
diff --git a/examples/http_handler/http_handler.cc b/examples/http_handler/http_handler.cc
index 8bdb9cd441a3720af05e90e8a93f0cf98e35e0a8..9237853055daae6415bbb35fd7e89a895827ffb2 100644
--- a/examples/http_handler/http_handler.cc
+++ b/examples/http_handler/http_handler.cc
@@ -9,6 +9,7 @@
#include "mojo/public/cpp/application/application_impl.h"
#include "mojo/public/cpp/bindings/interface_ptr.h"
#include "mojo/public/cpp/system/message_pipe.h"
+#include "mojo/services/network/public/interfaces/net_address.mojom.h"
#include "services/http_server/public/http_server.mojom.h"
#include "services/http_server/public/http_server_factory.mojom.h"
#include "services/http_server/public/http_server_util.h"
@@ -33,7 +34,19 @@ class HttpHandler : public ApplicationDelegate,
http_server::HttpServerFactoryPtr http_server_factory;
app->ConnectToService("mojo:http_server", &http_server_factory);
- http_server_factory->CreateHttpServer(GetProxy(&http_server_).Pass(), 80);
+
+ mojo::NetAddressPtr local_address(mojo::NetAddress::New());
+ local_address->family = mojo::NET_ADDRESS_FAMILY_IPV4;
+ local_address->ipv4 = mojo::NetAddressIPv4::New();
+ local_address->ipv4->addr.resize(4);
+ local_address->ipv4->addr[0] = 0;
+ local_address->ipv4->addr[1] = 0;
+ local_address->ipv4->addr[2] = 0;
+ local_address->ipv4->addr[3] = 0;
+ local_address->ipv4->port = 80;
+ http_server_factory->CreateHttpServer(GetProxy(&http_server_).Pass(),
+ local_address.Pass());
+
http_server_->SetHandler(
"/test",
http_handler_ptr.Pass(),
« no previous file with comments | « examples/http_handler/BUILD.gn ('k') | services/http_server/http_server_apptest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698