From 736b0f25003c92b3903798ce0a768230480d8f4b Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 27 Feb 2024 18:11:37 +0300 Subject: Fix curl constructor for nullfd input for HTTP POST method --- libbutl/curl.cxx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'libbutl') 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); -- cgit v1.1