Skip to content

Commit 36e030a

Browse files
robhancocksedBillyONeal
authored andcommitted
Remove the address_configured flag on tcp::resolver::query (#1145)
The default behavior for tcp::resolver::query uses the address_configured flag, which only returns addresses if a non-loopback address is available on the system. If this is called before a real network interface is brought up, then resolution will fail and the server won't be functional, even for requests on the loopback interface. Explicitly set the flags to default so that the address_configured flag is not specified. This allows the server to start up normally even when the system has no active network interfaces.
1 parent be807d4 commit 36e030a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Release/src/http/listener/http_server_asio.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,9 @@ void hostport_listener::start()
520520
auto& service = crossplat::threadpool::shared_instance().service();
521521
tcp::resolver resolver(service);
522522
// #446: boost resolver does not recognize "+" as a host wildchar
523-
tcp::resolver::query query = ("+" == m_host) ? tcp::resolver::query(m_port) : tcp::resolver::query(m_host, m_port);
523+
tcp::resolver::query query = ("+" == m_host) ?
524+
tcp::resolver::query(m_port, boost::asio::ip::resolver_query_base::flags()) :
525+
tcp::resolver::query(m_host, m_port, boost::asio::ip::resolver_query_base::flags());
524526

525527
tcp::endpoint endpoint = *resolver.resolve(query);
526528

0 commit comments

Comments
 (0)