From 0aaf8d7f64c9f5424fd33e75ea22d09e8ea84a05 Mon Sep 17 00:00:00 2001 From: electron128 Date: Thu, 26 Mar 2015 07:20:28 +0000 Subject: [PATCH] missing part of previous commit git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8077 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-nogui/src/retroshare.cc | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/retroshare-nogui/src/retroshare.cc b/retroshare-nogui/src/retroshare.cc index 86d71aafe..12e675dd5 100644 --- a/retroshare-nogui/src/retroshare.cc +++ b/retroshare-nogui/src/retroshare.cc @@ -76,10 +76,15 @@ int main(int argc, char **argv) std::string docroot = "./"; uint16_t httpPort = 0; + std::string listenAddress; + bool allowAllIps = false; argstream args(argc, argv); args >> parameter("webinterface", httpPort, "port", "Enable webinterface on the specified port", false); args >> parameter("docroot", docroot, "path", "Serve static files from this path.", false); + // unfinished + //args >> parameter("http-listen", listenAddress, "ipv6 address", "Listen only on the specified address.", false); + args >> option("http-allow-all", allowAllIps, "allow connections from all IP adresses (default: localhost only)"); args >> help(); if (args.helpRequested()) @@ -89,7 +94,13 @@ int main(int argc, char **argv) if(httpPort != 0) { - resource_api::ApiServerMHD httpd(docroot, httpPort); + resource_api::ApiServerMHD httpd; + + if(!httpd.configure(docroot, httpPort, listenAddress, allowAllIps)) + { + std::cerr << "Failed to configure the http server. Check your parameters." << std::endl; + return 1; + } resource_api::RsControlModule ctrl_mod(argc, argv, httpd.getApiServer().getStateTokenServer(), &httpd.getApiServer(), true); httpd.getApiServer().addResourceHandler("control", dynamic_cast(&ctrl_mod), &resource_api::RsControlModule::handleRequest); @@ -102,7 +113,7 @@ int main(int argc, char **argv) } httpd.stop(); - return 1; + return 0; } #endif