From 3d2984db9eda783d9b8d3d81cc637efeb70e38bd Mon Sep 17 00:00:00 2001 From: Bob Chen Date: Mon, 15 Jan 2024 21:23:13 +0800 Subject: [PATCH] [http] Wrong domain name fail immediately --- net/http/client.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/http/client.cpp b/net/http/client.cpp index 57fac913..7c9cf547 100644 --- a/net/http/client.cpp +++ b/net/http/client.cpp @@ -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); @@ -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");