Base code merged to SPIN 2.4
[platform/upstream/curl.git] / docs / libcurl / opts / CURLOPT_POSTREDIR.3
index cacb0aa..aa36bd0 100644 (file)
@@ -47,12 +47,26 @@ 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.
+only supported the 301 then. CURL_REDIR_POST_303 was added in 7.26.0.
 .SH RETURN VALUE
 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
 .SH "SEE ALSO"