curl-library
Re: FOLLOWLOCATION - notify caller if followed
Date: Wed, 9 Mar 2011 15:38:11 -0800
On Wed, Mar 09, 2011 at 06:22:35PM -0500, Pankaj Takawale wrote:
> I've setup CURLOPT_FOLLOWLOCATION curl option.
> Is there any way to know whether curl_easy_perform has followed new location
> due to http return code 302.
>
> If not, could you please point me to source code file/function where I can
> employ one callback routine to notify caller about such scenario.
There are several ways to do this. Your code can get CURLINFO_EFFECTIVE_URL
after the transfer, and if it doesn't match what was provided, then
a redirect was followed (or use CURLINFO_REDIRECT_COUNT or
CURLINFO_REDIRECT_URL to do something similar). Or, the code can install
a header callback and watch the HTTP responses as they are received. Or,
it can disable CURLOPT_FOLLOWLOCATION altogether and handle redirects
manually.
>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-03-10