Skip to content

Commit

Permalink
[http] Wrong domain name fail immediately
Browse files Browse the repository at this point in the history
  • Loading branch information
beef9999 committed Jan 16, 2024
1 parent 96da89c commit 3d2984d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/http/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ ISocketStream* PooledDialer::dial(std::string_view host, uint16_t port, bool sec
std::string strhost(host);
auto ipaddr = resolver->resolve(strhost.c_str());
if (ipaddr.undefined()) {
LOG_ERROR_RETURN(0, nullptr, "DNS resolve failed, name = `", host)
LOG_ERROR_RETURN(ENOENT, nullptr, "DNS resolve failed, name = `", host)
}

EndPoint ep(ipaddr, port);
Expand Down Expand Up @@ -165,7 +165,7 @@ class ClientImpl : public Client {
? m_dialer.dial(m_proxy_url, tmo.timeout())
: m_dialer.dial(req, tmo.timeout());
if (!s) {
if (errno == ECONNREFUSED) {
if (errno == ECONNREFUSED || errno == ENOENT) {
LOG_ERROR_RETURN(0, ROUNDTRIP_FAST_RETRY, "connection refused")
}
LOG_ERROR_RETURN(0, ROUNDTRIP_NEED_RETRY, "connection failed");
Expand Down

0 comments on commit 3d2984d

Please sign in to comment.