On Tue, 25 Feb 2025, Daniel Stenberg via curl-library wrote:
I propose [1] we add a way to change this: by adding a second bit for
CURLOPT_FOLLOWLOCATION called CURLFOLLOW_OBEYCODE. It instructs libcurl that
the response code should be adhered rather than ignored when following
redirects. When used and a 301/302/303 response code is received, libcurl
*changes* the method in spite of the given custom method.
I worked on a bit more and actually now lean towards *two* new modes for
CURLOPT_FOLLOWLOCATION. That makes the set work like this:
ENABLE - like always: the set custo method is used for all requests.
OBEYCODE - changes the method (or not) for the sequent request depending on
the specific status code in the redirect. On a 307/308, the original method is
kept.
FIRSTONLY - changes the method uncondtionally after the first request. To
which then depends on the status code that was returned.
[1] = https://github.com/curl/curl/pull/16473
--
/ daniel.haxx.se || https://rock-solid.curl.dev
--
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
Etiquette: https://curl.se/mail/etiquette.html