diff --git a/cups/http-addrlist.c b/cups/http-addrlist.c
index e4ffc3d..a989055 100644
--- a/cups/http-addrlist.c
+++ b/cups/http-addrlist.c
@@ -240,7 +240,10 @@ httpAddrConnect2(
     }
 
     if (!addrlist && nfds == 0)
+    {
+      errno = EHOSTDOWN;
       break;
+    }
 
    /*
     * See if we can connect to any of the addresses so far...
@@ -371,6 +374,9 @@ httpAddrConnect2(
       remaining -= 250;
   }
 
+  if (remaining <= 0)
+    errno = ETIMEDOUT;
+
   while (nfds > 0)
   {
     nfds --;
