cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Patch for 301/302 redirect after post

From: Martin Drasar <drasar_at_optimsys.cz>
Date: Mon, 04 Aug 2008 14:44:36 +0200

Daniel Stenberg napsal(a):
> On Mon, 4 Aug 2008, Martin Drasar wrote:
>
>>> You can easily detect 301/302 codes yourself when having it activated
>>> and then make them cause errors get returned.
>>
>> Can I? When CURLOPT_FOLLOWLOCATION is turned on? Please tell me how,
>> because that would render half of my patch unneeded.
>
> Sure, just use the HEADERFUNCTION and parse the headers you get passed
> to it. Identifying the first status line in a response should be easy.
>

Thanks, I have completely missed the headerfunction.

>> I understand that you don't want to fill the code with overly specific
>> features and having bool CURLOPT_POST302 is better than nothing for
>> sure...
>
> I would even prefer to proceed like this:
>
> 1 - CURLOPT_POST301 gets renamed to CURLOPT_POSTREDIR (while of course
> still
> supporting the old name for a number of years ahead) - of course if
> someone has a better idea for a name I'm open for it.
>
> 2 - CURLOPT_POSTREDIR then takes the original options 0 to act as
> default and
> 1 to change the 301 behavior. Then we add 2 to just change the 302
> behavior and 3 to change both 301 and 302.
>
> 3 - Then we create a few nice defines for these magic values so that we
> don't
> have to use magic constant numbers in app source code.
>
> What do you say?
>

Looking back in thread, this is the approach you have suggested before
and I am completely ok with that. I don't care how it is done as long as
it gets done :-)
And with that headerfunction I don't have a reason to rant ;-)

Do you want me to write a patch?

Martin

-- 
   Martin Drasar, Developer / Analyst
   OptimSys, s.r.o.
   drasar_at_optimsys.cz
   Tel: +420 541 143 065
   Fax: +420 541 143 066
   http://www.optimsys.cz
Received on 2008-08-04