mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-10 10:05:19 -04:00
missing part of previous commit
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8077 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
45ac4cca06
commit
0aaf8d7f64
1 changed files with 13 additions and 2 deletions
|
@ -76,10 +76,15 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
std::string docroot = "./";
|
std::string docroot = "./";
|
||||||
uint16_t httpPort = 0;
|
uint16_t httpPort = 0;
|
||||||
|
std::string listenAddress;
|
||||||
|
bool allowAllIps = false;
|
||||||
|
|
||||||
argstream args(argc, argv);
|
argstream args(argc, argv);
|
||||||
args >> parameter("webinterface", httpPort, "port", "Enable webinterface on the specified port", false);
|
args >> parameter("webinterface", httpPort, "port", "Enable webinterface on the specified port", false);
|
||||||
args >> parameter("docroot", docroot, "path", "Serve static files from this path.", 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();
|
args >> help();
|
||||||
|
|
||||||
if (args.helpRequested())
|
if (args.helpRequested())
|
||||||
|
@ -89,7 +94,13 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
if(httpPort != 0)
|
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);
|
resource_api::RsControlModule ctrl_mod(argc, argv, httpd.getApiServer().getStateTokenServer(), &httpd.getApiServer(), true);
|
||||||
httpd.getApiServer().addResourceHandler("control", dynamic_cast<resource_api::ResourceRouter*>(&ctrl_mod), &resource_api::RsControlModule::handleRequest);
|
httpd.getApiServer().addResourceHandler("control", dynamic_cast<resource_api::ResourceRouter*>(&ctrl_mod), &resource_api::RsControlModule::handleRequest);
|
||||||
|
@ -102,7 +113,7 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
httpd.stop();
|
httpd.stop();
|
||||||
|
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue