@@ -40,9 +40,9 @@ const char* blink1_server_version = BLINK1_VERSION;
40
40
41
41
static bool show_html = true;
42
42
43
- static char http_listen_host [120 ] = "localhost" ;
43
+ static char http_listen_host [120 ] = "localhost" ; // or 0.0.0.0 for any
44
44
static int http_listen_port = 8000 ;
45
- static char http_listen_address [100 ]; // will be "http://localhost:8000"
45
+ static char http_listen_url [100 ]; // will be "http://localhost:8000"
46
46
47
47
typedef struct cache_info_ {
48
48
blink1_device * dev ; // device, if opened, NULL otherwise
@@ -87,12 +87,12 @@ void usage()
87
87
" %s [options]\n"
88
88
"where [options] can be:\n"
89
89
" --port port, -p port port to listen on (default %d)\n"
90
- " --baseurl url , -U url set baseurl to listen in (default http://%s:%d )\n"
90
+ " --host host , -H host host to listen on ('127.0.0.1' or '0.0.0.0' )\n"
91
91
" --no-html do not serve static HTML help\n"
92
92
" --version version of this program\n"
93
93
" --help, -h this help page\n"
94
94
"\n" ,
95
- blink1_server_name , http_listen_port , http_listen_host , http_listen_port );
95
+ blink1_server_name , http_listen_port );
96
96
97
97
fprintf (stderr ,
98
98
"Supported URIs:\n" );
@@ -542,11 +542,11 @@ int main(int argc, char *argv[]) {
542
542
543
543
// parse options
544
544
int option_index = 0 , opt ;
545
- char * opt_str = "qvhp:U:A:" ;
545
+ char * opt_str = "qvhp:H: U:A:" ;
546
546
static struct option loptions [] = {
547
547
//{"verbose", optional_argument, 0, 'v'},
548
548
//{"quiet", optional_argument, 0, 'q'},
549
- {"baseurl" , required_argument , 0 , 'U' },
549
+ // {"baseurl", required_argument, 0, 'U'},
550
550
{"host" , required_argument , 0 , 'H' },
551
551
{"port" , required_argument , 0 , 'p' },
552
552
{"no-html" , no_argument , 0 , 'N' },
@@ -572,9 +572,6 @@ int main(int argc, char *argv[]) {
572
572
case 'N' :
573
573
show_html = false;
574
574
break ;
575
- case 'U' :
576
- strncpy (http_listen_address , optarg , sizeof (http_listen_address ));
577
- break ;
578
575
case 'H' :
579
576
strncpy (http_listen_host , optarg , sizeof (http_listen_host ));
580
577
break ;
@@ -606,7 +603,7 @@ int main(int argc, char *argv[]) {
606
603
blink1_server_name , blink1_server_version , http_listen_host ,
607
604
http_listen_port , (show_html ) ? "html help enabeld" : "no html help" );
608
605
609
- snprintf (http_listen_address , sizeof (http_listen_address ), "http://%s:%d/" ,
606
+ snprintf (http_listen_url , sizeof (http_listen_url ), "http://%s:%d/" ,
610
607
http_listen_host , http_listen_port );
611
608
612
609
// if( s_http_server_opts.document_root ) {
@@ -621,8 +618,8 @@ int main(int argc, char *argv[]) {
621
618
622
619
mg_mgr_init (& mgr );
623
620
624
- if ((c = mg_http_listen (& mgr , http_listen_address , ev_handler , & mgr )) == NULL ) {
625
- LOG (LL_ERROR , ("Cannot listen on %s. http_listen_address " , http_listen_address ));
621
+ if ((c = mg_http_listen (& mgr , http_listen_url , ev_handler , & mgr )) == NULL ) {
622
+ LOG (LL_ERROR , ("Cannot listen on %s." , http_listen_url ));
626
623
exit (EXIT_FAILURE );
627
624
}
628
625
0 commit comments