Skip to content

Commit

Permalink
resty: Add workaround for new curl versions
Browse files Browse the repository at this point in the history
As Mathieu found out, his new curl version won't process the empty
string being passed to curl as argument, resulting from the no-body case
for GET. The empty string was treated as additional URL which was
skipped over in the past with a warning but now it's a hard error.
  • Loading branch information
pothos committed Apr 16, 2024
1 parent fe7e0a2 commit fb4cc95
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion resty
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,13 @@ HELP

# Forge command and display it if dry-run
local cmd
cmd=(curl -sLv $curl_opt $(printf "%q" "$body") -X $method -b \"$cookies/$domain\" -c \"$cookies/$domain\" "$(\
# Flatcar: Add workaround for new curl versions
local body_arg=()
body_arg=($(printf "%q" "$body"))
if [ "${body_arg[*]}" = "" ] || [ "${body_arg[*]}" = "''" ]; then
body_arg=()
fi
cmd=(curl -sLv $curl_opt "${body_arg[@]}" -X $method -b \"$cookies/$domain\" -c \"$cookies/$domain\" "$(\
[ -n "$curlopt_cmd" ] && printf '%s ' ${curlopt_cmd[@]})"\"$_path$query\")
if [ "$dry_run" = "yes" ] ; then
echo "${cmd[@]}"
Expand Down

0 comments on commit fb4cc95

Please sign in to comment.