cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-library Mailing List Archives

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

From: Henrik StÝrner <henrik-curl_at_hswn.dk>
Date: Tue, 8 Jul 2003 23:11:03 +0200

Greetings!

I am happily using libcurl to build an add-on for the Big Brother
network monitor (http://bb4.com/). 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 "http://www.somesite.com/", I have no
control over which of the three DNS entries for "www.somesite.com"
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, "192.168.1.2");
   curl_easy_setopt(handle, CURLOPT_URL, "http://www.foo.com/");
   curl_easy_perform(handle);

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.
www.parasoft.com/bulletproofapps
Received on 2003-07-08

These mail archives are generated by hypermail.

donate! Page updated November 12, 2010.
web site info

File upload with ASP.NET