cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: IP addresses of redirected servers

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 22 Feb 2011 22:14:46 +0100 (CET)

On Tue, 22 Feb 2011, Bin Wang wrote:

> We use libcurl with CURLOPT_FOLLOWLOCATION option turned on. We have a need
> to obtain the IP addresses of all the servers libcurl tries to connect along
> the whole redirection process.
>
> Since libcurl currently does not provide this, I am thinking about extending
> libcurl. I can think of two approaches of doing this:

Allow me to offer yet another way to solve your problem:

1. Don't enable CURLOPT_FOLLOWLOCATION

2. Use curl_easy_getinfo's CURLINFO_PRIMARY_IP to get the IP

3. Use curl_easy_getinfo's CURLINFO_REDIRECT_URL to extract redirect URLs and
redirect there "manually".

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2011-02-22