cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: libCurl 7.20.0 behaviour when handling HTTP 302 responses

From: Stefan Krause <Stefan.Krause_at_gmx.net>
Date: Wed, 14 Apr 2010 15:13:30 +0200

-------- Original-Nachricht --------
> Datum: Wed, 14 Apr 2010 14:20:41 +0200 (CEST)
> Von: Daniel Stenberg <daniel_at_haxx.se>
> An: libcurl development <curl-library_at_cool.haxx.se>
> Betreff: Re: libCurl 7.20.0 behaviour when handling HTTP 302 responses

> On Wed, 14 Apr 2010, Stefan Krause wrote:
>
> > I just tried to dig into the issue. I am quite sure, that libCurl 7.20.0
> > hehaves the way I described.
> >
> > 1) My App: Send GET Req to http://server/redirect, Server responds with
> HTTP
> > 302, Location: http://server/target
>
> > 2) libCurl resends the GET Req to http://server/target automatically
> > (CURLOPT_FOLLOWLOCATION = 1)
>
> > 3) My App: Send GET via Easy-Handle from step 1 to
> http://server/redirect.
> > HERE: libcurl sends request to http://server/target ! NOT to
> > http://server/redirect as expected !
>
> I didn't contradict that description. On the contrary I said explictly
> that
> libcurl never remembers the target URL in any location following.
>
> But then I find it funny that you argue this for the 302 case, as that is
> a
> response code that mandates that we should always use the *Request-URI* on
> further requests, and not the target URI of the redirect which you seem to
> argue for.

In step 3 above, I issued a second GET request to http://server/redirect (that is what I understand is the Request-URI). Before, I did not explicitely set the Request-URI to http://server/redirect on that easy handle, because thats already done in step 1 (not explicitely mentioned). I expect the Request URI of the easy handle is not changed somehow internally by libCurl and therefore remains http://server/redirect after I set it explicitely in step 1.

In step 3 above, I expected the same message flow as in step 1 + 2. libCurl first sends the request to http://server/redirect, gets the HTTP 302 again and then sends it automatically to http://server/target. (as you said: no caching behaviour)
But that does not happen due to my observations.

Regards,
   Stefan

-- 
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2010-04-14