From: Torsten Dreyer Date: Sat, 29 Mar 2014 21:07:12 +0000 (+0100) Subject: allow binding of httpd to an address, not just a port X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=44ba076720c68460ab9afec46e8f33e0d2ac899f;p=flightgear.git allow binding of httpd to an address, not just a port support --httpd=127.0.0.1:8080 --- diff --git a/src/Main/options.cxx b/src/Main/options.cxx index 2cf964944..d055b968a 100644 --- a/src/Main/options.cxx +++ b/src/Main/options.cxx @@ -953,10 +953,12 @@ fgOptStartDateGmt( const char *arg ) static int fgOptHttpd( const char * arg ) { - int port = atoi(arg); - if( port > 0 ) { - fgSetInt( string(flightgear::http::PROPERTY_ROOT).append("/options/listening-port").c_str(), port ); - } + // port may be any valid address:port notation + // like 127.0.0.1:8080 + // or just the port 8080 + string port = simgear::strutils::strip(string(arg)); + if( port.empty() ) return FG_OPTIONS_ERROR; + fgSetString( string(flightgear::http::PROPERTY_ROOT).append("/options/listening-port").c_str(), port ); return FG_OPTIONS_OK; }