cURL / Mailing Lists / curl-library / Single Mail


libcurl function to specify IP address of webserver (bypassing DNS)

From: Henrik StÝrner <>
Date: Tue, 8 Jul 2003 23:11:03 +0200


I am happily using libcurl to build an add-on for the Big Brother
network monitor ( Part of this involves testing
that webservers are alive and respond to requests; libcurl has
made that job a lot easier.

One thing I am missing is the ability to control exactly which
server libcurl connects to when curl_easy_perform() is invoked.
At work I want to test a load-balanced set of servers; if I just
provide the hostname as "", I have no
control over which of the three DNS entries for ""
I end up testing.

So my question is: Would it be possible to implement a libcurl
function that tells curl which IP-address to connect to,
bypassing the normal DNS lookup ? Something like

   curl_easy_setopt(handle, CURLOPT_SERVER_IP, "");
   curl_easy_setopt(handle, CURLOPT_URL, "");

I guess it *could* be done by mangling the URL to replace the
hostname with the IP-address I want, then calling curl_easy_setopt
with CURLOPT_HTTPHEADER and defining the "Host:" header. But
I'd rather avoid mangling the URL myself.

Henrik Storner
This SF.Net email sponsored by: Parasoft
Error proof Web apps, automate testing & more.
Download & eval WebKing and get a free book.
Received on 2003-07-08