Skip to content

Commit

Permalink
Use a timeout in the call to resolveHost
Browse files Browse the repository at this point in the history
If a connection timeout was set, then use it
in the call to resolveHost() just as it's used
in the call to connectTCPWithTimeout().
  • Loading branch information
AndrejMitrovic committed Aug 19, 2020
1 parent 35079d4 commit 3db1562
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions http/vibe/http/client.d
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,8 @@ final class HTTPClient {
use_dns = true;
}

NetworkAddress proxyAddr = resolveHost(m_settings.proxyURL.host, m_settings.dnsAddressFamily, use_dns);
NetworkAddress proxyAddr = resolveHost(m_settings.proxyURL.host, m_settings.dnsAddressFamily, use_dns,
m_settings.connectTimeout);
proxyAddr.port = m_settings.proxyURL.port;
m_conn = connectTCPWithTimeout(proxyAddr, m_settings.networkInterface, m_settings.connectTimeout);
}
Expand All @@ -700,13 +701,13 @@ final class HTTPClient {
() @trusted { strcpy(cast(char*)s.sun_path.ptr,m_server.toStringz()); } ();
} else
{
addr = resolveHost(m_server, m_settings.dnsAddressFamily);
addr = resolveHost(m_server, m_settings.dnsAddressFamily, true, m_settings.connectTimeout);
addr.port = m_port;
}
m_conn = connectTCPWithTimeout(addr, m_settings.networkInterface, m_settings.connectTimeout);
} else
{
auto addr = resolveHost(m_server, m_settings.dnsAddressFamily);
auto addr = resolveHost(m_server, m_settings.dnsAddressFamily, true, m_settings.connectTimeout);
addr.port = m_port;
m_conn = connectTCPWithTimeout(addr, m_settings.networkInterface, m_settings.connectTimeout);
}
Expand Down

0 comments on commit 3db1562

Please sign in to comment.