cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Re: Stopping redirects being followed from header callback

From: Felix Hassert <felix-sf_at_7val.com>
Date: Wed, 28 May 2008 13:16:38 +0200

Hi,

Daniel Stenberg wrote:
> That's not supported by libcurl. Unless you set the max redir option
> that limits how many redirections it should follow.
OK, setting CURLOPT_MAXREDIRS to a number smaller than the actual
redir count stops the chain. Thanks for pointing that out.

But I have to do it exactly when the header callback reads the
location header (which is no problem). If I do that later (on the last
header line) the redirect seems already to be scheduled.

> The intent has always been that if you need fancy redirect
> following, you should rather do it yourself than telling libcurl to
> do it.
Yes, I understand that. I have done it outside libcurl before by not
having set CURLOPT_FOLLOWREDIRECT and executing the handle with the
new url again. But this solution gets complicated when you have a
couple of parallel requests in a multi-handle. Especially when it
comes to more exotic redirections (305, 307) it is nicer to rely on
libcurl doing the right thing.

> This will be a lot easier to do once 7.18.2 comes out and gets used.
How will 7.18.2 affect my problem? Will the changes be visible through
the PHP API as well?

Thanks -
felix.
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2008-05-28