curl-library
Re: Overriding DNS queries
Date: Fri, 11 May 2001 08:18:33 +0200 (MET DST)
On Thu, 10 May 2001, Steve Atkins wrote:
> I need to be able to send an HTTP request to a specific IP address,
> overriding the hostname->IP mapping that libcurl would normally do,
> something like:
>
> curl_easy_setopt(curl, CURLOPT_URL, "http://example.invalid/")
> curl_easy_setopt(curl, CURLOPT_ADDRESS, "172.17.10.11")
>
> ...to connect to 172.17.10.11 and do a
>
> GET / HTTP/1.1
> Host: example.invalid
>
> Is this functionality there? If not, would it be a useful addition to
> patch in?
The functionality is there, but the approach is slightly different. Use an
existing and working URL, and then add your own 'Host:' header. Something
like this:
struct curl_slist *heads;
curl_easy_setopt(curl, CURLOPT_URL, "http://172.17.10.11");
heads = curl_slist_append(heads, "Host: example.invalid");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, heads);
curl_easy_perform(curl);
curl_slist_free_all(heads);
-- Daniel Stenberg -- curl project maintainer -- http://curl.haxx.se/ _______________________________________________ Curl-library mailing list Curl-library_at_lists.sourceforge.net http://lists.sourceforge.net/lists/listinfo/curl-libraryReceived on 2001-05-11