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 11:59:34 +0200

>From: Daniel Stenberg <daniel_at_haxx.se>
>Date: Tue, 13 Apr 2010 13:16:34 +0200 (CEST)
>
>> in case libCurl receives a HTTP 302 status, it automatically (if configured)
>> send the HTTP request again to the URL received in the "Location" header. I
>> observed, that in following GET requests to the same URL (no the new from
>> "Location" header; the original one) on the same easy handle, libCurl uses
>> the URL from the "Location" header received before.

>No it doesn't. libcurl never remembers the location-following like that.
>That's left for the app to do if it truly wants to behave as the best >possible
>netizen.

Hi Daniel,

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 !

In http.c line 2535 result = Curl_add_buffer(req_buffer, ppath, strlen(ppath));
-> ppath does not change anymore after the first redirection. Then it is permanently set to http://server/target

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