diff options
Diffstat (limited to 'docs/libcurl/opts/CURLOPT_POSTREDIR.3')
-rw-r--r-- | docs/libcurl/opts/CURLOPT_POSTREDIR.3 | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/docs/libcurl/opts/CURLOPT_POSTREDIR.3 b/docs/libcurl/opts/CURLOPT_POSTREDIR.3 index b9660a944..aa36bd0f5 100644 --- a/docs/libcurl/opts/CURLOPT_POSTREDIR.3 +++ b/docs/libcurl/opts/CURLOPT_POSTREDIR.3 @@ -47,9 +47,23 @@ when setting \fICURLOPT_FOLLOWLOCATION(3)\fP. .SH DEFAULT 0 .SH PROTOCOLS -HTTP +HTTP(S) .SH EXAMPLE -TODO +.nf +CURL *curl = curl_easy_init(); +if(curl) { + curl_easy_setopt(curl, CURLOPT_URL, "http://example.com"); + + /* a silly POST example */ + curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "data=true"); + + /* example.com is redirected, so we tell libcurl to send POST on 301, 302 and + 303 HTTP response codes */ + curl_easy_setopt(curl, CURLOPT_POSTREDIR, CURL_REDIR_POST_ALL); + + curl_easy_perform(curl); +} +.fi .SH AVAILABILITY Added in 7.17.1. This option was known as CURLOPT_POST301 up to 7.19.0 as it only supported the 301 then. CURL_REDIR_POST_303 was added in 7.26.0. |