Buy commercial curl support. We
help you work out your issues, debug your libcurl applications, use the API,
port to new platforms, add new features and more. With a team lead by the
curl founder Daniel himself.
Not always using CURLOPT_CUSTOMREQUEST on redirects
- Contemporary messages sorted: [ by date ] [ by thread ] [ by subject ] [ by author ] [ by messages with attachments ]
From: Daniel Stenberg via curl-library <curl-library_at_lists.haxx.se>
Date: Tue, 25 Feb 2025 11:40:38 +0100 (CET)
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
Date: Tue, 25 Feb 2025 11:40:38 +0100 (CET)
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.htmlReceived on 2025-02-25