diff -ur curl-7.16.4/include/curl/curl.h curl-7.16.4.local/include/curl/curl.h
--- curl-7.16.4/include/curl/curl.h	Sun Jul  1 15:01:19 2007
+++ curl-7.16.4.local/include/curl/curl.h	Wed Sep 12 15:08:29 2007
@@ -210,6 +210,8 @@
                                       double ultotal,
                                       double ulnow);
 
+typedef int (*curl_checkip_callback)(struct sockaddr *ai_addr);
+
 #ifndef CURL_MAX_WRITE_SIZE
   /* Tests have proven that 20K is a very bad buffer size for uploads on
      Windows, while 16K for some odd reason performed a lot better.
@@ -1083,6 +1085,11 @@
   CINIT(NEW_FILE_PERMS, LONG, 159),
   CINIT(NEW_DIRECTORY_PERMS, LONG, 160),
 
+  /* Function that will be called to validate the address resolved. The
+   * parameters will be (struct sockaddr *ai_addr). function must return -1 if bad address or 0 if ok
+   * if name resolves into several IP addresses the function will be called for all of them. */
+  CINIT(CHECKIPFUNCTION, FUNCTIONPOINT, 161),
+  
   CURLOPT_LASTENTRY /* the last unused */
 } CURLoption;
 
diff -ur curl-7.16.4/lib/hostasyn.c curl-7.16.4.local/lib/hostasyn.c
--- curl-7.16.4/lib/hostasyn.c	Tue Apr  3 13:15:37 2007
+++ curl-7.16.4.local/lib/hostasyn.c	Wed Sep 12 15:09:14 2007
@@ -132,6 +132,17 @@
 
       if(data->share)
         Curl_share_unlock(data, CURL_LOCK_DATA_DNS);
+
+      //check ip
+      if(conn->data->set.checkip && dns && dns->addr){
+       Curl_addrinfo *tmpaddr;
+       for(tmpaddr=dns->addr; tmpaddr; tmpaddr=tmpaddr->ai_next)
+         if(conn->data->set.checkip(tmpaddr->ai_addr)<0) {
+             conn->async.status = ARES_ENOTFOUND;
+             break;
+           }
+      }
+
     }
     else
       rc = CURLE_OUT_OF_MEMORY;
diff -ur curl-7.16.4/lib/hostip.c curl-7.16.4.local/lib/hostip.c
--- curl-7.16.4/lib/hostip.c	Sun Jul  1 15:01:19 2007
+++ curl-7.16.4.local/lib/hostip.c	Wed Sep 12 15:09:46 2007
@@ -497,6 +497,14 @@
       Curl_share_unlock(data, CURL_LOCK_DATA_DNS);
     rc = CURLRESOLV_RESOLVED;
   }
+  //check ip
+  if(data->set.checkip && dns && dns->addr){
+    Curl_addrinfo *tmpaddr;
+    for(tmpaddr=dns->addr; tmpaddr; tmpaddr=tmpaddr->ai_next)
+      if(data->set.checkip(tmpaddr->ai_addr)<0)
+       return CURLRESOLV_ERROR;
+  }
+
 
   *entry = dns;
 
diff -ur curl-7.16.4/lib/url.c curl-7.16.4.local/lib/url.c
--- curl-7.16.4/lib/url.c	Sun Jul  1 15:01:19 2007
+++ curl-7.16.4.local/lib/url.c	Wed Sep 12 15:10:36 2007
@@ -1315,6 +1315,11 @@
       data->progress.callback = FALSE; /* NULL enforces internal */
 
     break;
+
+  case CURLOPT_CHECKIPFUNCTION:
+    data->set.checkip = va_arg(param, curl_checkip_callback);
+    break;
+
   case CURLOPT_PROGRESSDATA:
     /*
      * Custom client data to pass to the progress callback
diff -ur curl-7.16.4/lib/urldata.h curl-7.16.4.local/lib/urldata.h
--- curl-7.16.4/lib/urldata.h	Sun Jul  1 15:01:19 2007
+++ curl-7.16.4.local/lib/urldata.h	Wed Sep 12 15:11:40 2007
@@ -1225,6 +1225,7 @@
   curl_debug_callback fdebug;      /* function that write informational data */
   curl_ioctl_callback ioctl;       /* function for I/O control */
   curl_sockopt_callback fsockopt;  /* function for setting socket options */
+  curl_checkip_callback checkip;   /* function for verifying ip address */
   void *sockopt_client; /* pointer to pass to the socket options callback */
 
   /* the 3 curl_conv_callback functions below are used on non-ASCII hosts */
