@@ -289,8 +289,8 @@ bool webserver::start(bool blocking)
289289 this )
290290 );
291291 iov.push_back (gen (MHD_OPTION_CONNECTION_TIMEOUT, connection_timeout));
292- if (bind_address != 0x0 )
293- iov.push_back (gen (MHD_OPTION_SOCK_ADDR, (intptr_t ) bind_address));
292+ // if(bind_address != 0x0)
293+ // iov.push_back(gen(MHD_OPTION_SOCK_ADDR, (intptr_t) bind_address));
294294 if (bind_socket != 0 )
295295 iov.push_back (gen (MHD_OPTION_LISTEN_SOCKET, bind_socket));
296296 if (start_method == http_utils::THREAD_PER_CONNECTION && max_threads != 0 )
@@ -361,12 +361,23 @@ bool webserver::start(bool blocking)
361361 start_conf |= MHD_USE_TCP_FASTOPEN;
362362#endif
363363
364- struct MHD_Daemon * daemon = MHD_start_daemon
365- (
366- start_conf, this ->port , &policy_callback, this ,
367- &answer_to_connection, this , MHD_OPTION_ARRAY,
368- &iov[0 ], MHD_OPTION_END
369- );
364+ struct MHD_Daemon * daemon = NULL ;
365+ if (bind_address == 0x0 ) {
366+ daemon = MHD_start_daemon
367+ (
368+ start_conf, this ->port , &policy_callback, this ,
369+ &answer_to_connection, this , MHD_OPTION_ARRAY,
370+ &iov[0 ], MHD_OPTION_END
371+ );
372+ } else {
373+ daemon = MHD_start_daemon
374+ (
375+ start_conf, 1 , &policy_callback, this ,
376+ &answer_to_connection, this , MHD_OPTION_ARRAY,
377+ &iov[0 ], MHD_OPTION_SOCK_ADDR, bind_address, MHD_OPTION_END
378+ );
379+ }
380+
370381 if (NULL == daemon)
371382 {
372383 cout << gettext (" Unable to connect daemon to port: " ) <<
0 commit comments