summaryrefslogtreecommitdiff
path: root/docs/libcurl
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2022-01-17 22:58:49 +0100
committerDaniel Stenberg <daniel@haxx.se>2022-01-17 22:58:49 +0100
commitffc939826bb05cc97168878eb596c3e5c228bd16 (patch)
tree8e06a46d969d7ce9ef6677f499ba71cd3e5b140d /docs/libcurl
parent52826d3b791e0436a2338ed36e38a2f7e1f4e9a6 (diff)
downloadcurl-bagder/ignore-custom-request-on-redir.tar.gz
CURLOPT_FOLLOWLOCATION: add a CURLFOLLOW_NO_CUSTOMMETHOD bitbagder/ignore-custom-request-on-redir
With this change, the argument passed to the CURLOPT_FOLLOWLOCATION option is treated as a bitmask instead of just a long. If the new CURLFOLLOW_NO_CUSTOMMETHOD bit is set in the bitmask, it means that libcurl will NOT allow a custom method override the HTTP request method after a redirect is followed. As is otherwise the default behavior (that surprises many users). This change is forward compatible because CURLOPT_FOLLOWLOCATION has been documented to accept the exact value of '1' to enable redirect following and therefore the other bits were left unused and undefined. We now add value to another bit. Starting in 7.66.0, the value 1 and the first bit still enables plain redirect following but the second bit adds more meaning. This change is backward compatible in the following way: setting the CURLFOLLOW_NO_CUSTOMMETHOD bit in a program that still uses an older libcurl installation at run-tim will have no effect. This is because older libcurl code checked if the value was non-zero and then enabled redirect following. Of course older libcurl will always let the set CURLOPT_CUSTOMMETHOD string override the method, disregarding what the HTTP response code suggests. Test 1589 added to verify the functionality. Closes #8130
Diffstat (limited to 'docs/libcurl')
-rw-r--r--docs/libcurl/opts/CURLOPT_CUSTOMREQUEST.37
-rw-r--r--docs/libcurl/opts/CURLOPT_FOLLOWLOCATION.316
-rw-r--r--docs/libcurl/symbols-in-versions2
3 files changed, 20 insertions, 5 deletions
diff --git a/docs/libcurl/opts/CURLOPT_CUSTOMREQUEST.3 b/docs/libcurl/opts/CURLOPT_CUSTOMREQUEST.3
index 9b6401b7b..35c1f8a91 100644
--- a/docs/libcurl/opts/CURLOPT_CUSTOMREQUEST.3
+++ b/docs/libcurl/opts/CURLOPT_CUSTOMREQUEST.3
@@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
-.\" * Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" * Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
.\" *
.\" * This software is licensed as described in the file COPYING, which
.\" * you should have received as part of this distribution. The terms
@@ -60,6 +60,11 @@ possibly confuse the remote server badly. Use \fICURLOPT_POST(3)\fP and
to replace or extend the set of headers sent by libcurl. Use
\fICURLOPT_HTTP_VERSION(3)\fP to change HTTP version.
+If this option used together with \fICURLOPT_FOLLOWLOCATION(3)\fP, the custom
+set method will override the method libcurl could otherwise change to. You can
+fine-tune that decision by using the \fICURLFOLLOW_NO_CUSTOMMETHOD\fP bit to
+\fICURLOPT_FOLLOWLOCATION(3)\fP to make redirects ignore the custom method.
+
.IP FTP
Instead of LIST and NLST when performing FTP directory listings.
.IP IMAP
diff --git a/docs/libcurl/opts/CURLOPT_FOLLOWLOCATION.3 b/docs/libcurl/opts/CURLOPT_FOLLOWLOCATION.3
index a94b9dfae..197a887da 100644
--- a/docs/libcurl/opts/CURLOPT_FOLLOWLOCATION.3
+++ b/docs/libcurl/opts/CURLOPT_FOLLOWLOCATION.3
@@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
-.\" * Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" * Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
.\" *
.\" * This software is licensed as described in the file COPYING, which
.\" * you should have received as part of this distribution. The terms
@@ -30,9 +30,15 @@ CURLOPT_FOLLOWLOCATION \- follow HTTP 3xx redirects
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FOLLOWLOCATION, long enable);
.fi
.SH DESCRIPTION
-A long parameter set to 1 tells the library to follow any Location: header
-that the server sends as part of an HTTP header in a 3xx response. The
-Location: header can specify a relative or an absolute URL to follow.
+The long parameter \fIenable\fP set to 1 tells the library to follow any
+Location: header that the server sends as part of an HTTP header in a 3xx
+response. The Location: header can specify a relative or an absolute URL to
+follow.
+
+\fIenable\fP is a bitmask. If you set the \fICURLFOLLOW_NO_CUSTOMMETHOD\fP
+bit, it will tell libcurl that the method set with
+\fICURLOPT_CUSTOMREQUEST(3)\fP will not be used after a redirect if the HTTP
+response says so.
libcurl will issue another request for the new URL and follow new Location:
headers all the way until no more such headers are returned.
@@ -75,6 +81,8 @@ if(curl) {
.fi
.SH AVAILABILITY
Along with HTTP
+
+CURLFOLLOW_NO_CUSTOMMETHOD was added in 7.82.0
.SH RETURN VALUE
Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not.
.SH "SEE ALSO"
diff --git a/docs/libcurl/symbols-in-versions b/docs/libcurl/symbols-in-versions
index 3fcfa339a..341d765f2 100644
--- a/docs/libcurl/symbols-in-versions
+++ b/docs/libcurl/symbols-in-versions
@@ -173,6 +173,8 @@ CURLFINFOFLAG_KNOWN_PERM 7.21.0
CURLFINFOFLAG_KNOWN_SIZE 7.21.0
CURLFINFOFLAG_KNOWN_TIME 7.21.0
CURLFINFOFLAG_KNOWN_UID 7.21.0
+CURLFOLLOW_ENABLE 7.82.0
+CURLFOLLOW_NO_CUSTOMMETHOD 7.82.0
CURLFORM_ARRAY 7.9.1 7.56.0
CURLFORM_ARRAY_END 7.9.1 7.9.5 7.9.6
CURLFORM_ARRAY_START 7.9.1 7.9.5 7.9.6