cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: libCurl 7.20.0 behaviour when handling HTTP 302 responses

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 14 Apr 2010 14:20:41 +0200 (CEST)

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.

I would claim that if there's an eerror here, it is for other 30X responses
than 302 when libcurl possibly should remember the redirect and not redo it -
but as I said it has no such cache and will not.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2010-04-14