aboutsummaryrefslogtreecommitdiff
path: root/libbutl
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2024-02-27 18:11:37 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2024-02-27 19:09:37 +0300
commit736b0f25003c92b3903798ce0a768230480d8f4b (patch)
treed9b2209258b3b3dd998364453a5622ee02ab6664 /libbutl
parenta1ea72d719b63a4d2b6421ce2e53b7e3ab12a8a1 (diff)
Fix curl constructor for nullfd input for HTTP POST method
Diffstat (limited to 'libbutl')
-rw-r--r--libbutl/curl.cxx13
1 files changed, 12 insertions, 1 deletions
diff --git a/libbutl/curl.cxx b/libbutl/curl.cxx
index 7efd28d..5649965 100644
--- a/libbutl/curl.cxx
+++ b/libbutl/curl.cxx
@@ -21,9 +21,20 @@ namespace butl
{
case ftp_put:
throw invalid_argument ("no input specified for PUT method");
+ case http_post:
+ {
+ // Post the empty data.
+ //
+ // Note that while it's tempting to specify the --request POST option
+ // instead, that can potentially overwrite the request methods for the
+ // HTTP 30X response code redirects.
+ //
+ d.options.push_back ("--data-raw");
+ d.options.push_back ("");
+ }
+ // Fall through.
case ftp_get:
case http_get:
- case http_post:
{
d.pipe.in = fdopen_null (); // /dev/null
return pipe (d.pipe);