diff options
author | Jay Satiro <raysatiro@yahoo.com> | 2016-06-11 17:33:16 -0400 |
---|---|---|
committer | Jay Satiro <raysatiro@yahoo.com> | 2016-06-11 17:33:16 -0400 |
commit | f77dfbc5fbb7a20f8d3ef918df35b68c0b60f1e9 (patch) | |
tree | aea39e7383948e5d3977230148f03c6ab616c4ab | |
parent | 929520582cdd3708f845af637757837b1d2a7d16 (diff) |
CURLOPT_POSTFIELDS.3: Clarify what happens when set empty
When CURLOPT_POSTFIELDS is set to an empty string libcurl will send a
zero-byte POST. Prior to this change it was documented as sending data
from the read callback.
This also changes the wording of what happens when empty or NULL so that
it's hopefully easier to understand for people whose primary language
isn't English.
Bug: https://github.com/curl/curl/issues/862
Reported-by: Askar Safin
-rw-r--r-- | docs/libcurl/opts/CURLOPT_POSTFIELDS.3 | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/docs/libcurl/opts/CURLOPT_POSTFIELDS.3 b/docs/libcurl/opts/CURLOPT_POSTFIELDS.3 index f9f9eadc8..17ec2d76f 100644 --- a/docs/libcurl/opts/CURLOPT_POSTFIELDS.3 +++ b/docs/libcurl/opts/CURLOPT_POSTFIELDS.3 @@ -42,16 +42,15 @@ This POST is a normal application/x-www-form-urlencoded kind (and libcurl will set that Content-Type by default when this option is used), which is commonly used by HTML forms. Change Content-Type with \fICURLOPT_HTTPHEADER(3)\fP. -Using \fICURLOPT_POSTFIELDS(3)\fP implies \fICURLOPT_POST(3)\fP. - You can use \fIcurl_easy_escape(3)\fP to url-encode your data, if necessary. It returns a pointer to an encoded string that can be passed as \fIpostdata\fP. -If you want to do a zero-byte POST, you need to set -\fICURLOPT_POSTFIELDSIZE(3)\fP explicitly to zero, as simply setting -\fICURLOPT_POSTFIELDS(3)\fP to NULL or "" just effectively disables the -sending of the specified string. libcurl will instead assume that you'll send -the POST data using the read callback! +Using \fICURLOPT_POSTFIELDS(3)\fP implies \fICURLOPT_POST(3)\fP. + +If \fICURLOPT_POSTFIELDS(3)\fP is explicitly set to NULL then libcurl will get +the POST data from the read callback. If you want to send a zero-byte POST set +\fICURLOPT_POSTFIELDS(3)\fP to an empty string, or set \fICURLOPT_POST(3)\fP to +1 and \fICURLOPT_POSTFIELDSIZE(3)\fP to 0. Using POST with HTTP 1.1 implies the use of a "Expect: 100-continue" header. You can disable this header with \fICURLOPT_HTTPHEADER(3)\fP as usual. |