Hey,

One of the longest running problems with using CURLOPT_CUSTOMREQUEST + CURLOPT_FOLLOWLOCATION has been the fact that the custom method is set for *all* subsequent requests even on redirects, independently of the specific response code that is returned. Because that's how it was once done and we have stuck to the behavior for consistency even though it has also caused problems for users.

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.

Thoughts? Better name? Better approaches?

With this improvement, we should be able to better support the coming new HTTP method QUERY in the curl tool that I emailed about separately [2].

[1] = https://github.com/curl/curl/pull/16473

[2] = https://curl.se/mail/archive-2025-02/0010.html

--

 / daniel.haxx.se || https://rock-solid.curl.dev
--
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html

Reply via email to