--- curl-7.17.1.orig/lib/url.c	2007-10-27 02:25:19.000000000 +0400
+++ curl-7.17.1/lib/url.c	2007-12-25 11:40:14.000000000 +0300
@@ -2348,20 +2348,8 @@
       continue;
     }
 
-#ifdef CURLRES_ASYNCH
-    /* ip_addr_str is NULL only if the resolving of the name hasn't completed
-       yet and until then we don't re-use this connection */
-    if (!check->ip_addr_str) {
-      infof(data,
-            "Connection #%ld hasn't finished name resolve, can't reuse\n",
-            check->connectindex);
-      continue;
-    }
-#endif
-
-    if ((check->sock[FIRSTSOCKET] == CURL_SOCKET_BAD) || check->bits.close) {
-      /* Don't pick a connection that hasn't connected yet or that is going to
-         get closed. */
+    if (check->sock[FIRSTSOCKET] == CURL_SOCKET_BAD) {
+      /* Don't pick a connection that does not have a socket yet. */
       infof(data, "Connection #%ld isn't open enough, can't reuse\n",
             check->connectindex);
 #ifdef CURLDEBUG
@@ -2441,7 +2429,7 @@
     }
     else { /* The requested needle connection is using a proxy,
               is the checked one using the same host, port and type? */
-      if(check->bits.proxy &&
+      if(check->bits.httpproxy &&
          (needle->proxytype == check->proxytype) &&
          strequal(needle->proxy.name, check->proxy.name) &&
          needle->port == check->port) {
@@ -4312,11 +4300,17 @@
 
   if(CURLE_OK == code) {
     /* no error */
-    if(dns || !*asyncp)
+    /*if(dns || !*asyncp)*/
       /* If an address is available it means that we already have the name
          resolved, OR it isn't async. if this is a re-used connection 'dns'
          will be NULL here. Continue connecting from here */
+    if(dns)
+      /* If an address is available it means that we already have the name
+         resolved. Continue connecting from here */
       code = SetupConnection(*in_connect, dns, protocol_done);
+    else if(!*asyncp)
+      /* Connection is reused */
+      *protocol_done = TRUE;
     /* else
        response will be received and treated async wise */
   }
