Skip to content

Commit

Permalink
Allow sending headers with empty values,
Browse files Browse the repository at this point in the history
while also allowing the user to remove default headers set by libcurl.
See https://curl.se/libcurl/c/CURLOPT_HTTPHEADER.html for more details.

passing " headers: {'h1' => 'v1', 'h2' => '', 'h3;' => ''} "
corresponds to these curl options: " -H 'h1: v1' -H 'h2:'  -H 'h3;' "

Enhances typhoeus#132
Fixes typhoeus/typhoeus#706
  • Loading branch information
gonubana committed Dec 1, 2022
1 parent d466523 commit 23b3454
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/ethon/easy/header.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def header_list
#
# @return [ String ] The composed header.
def compose_header(key, value)
Util.escape_zero_byte("#{key}: #{value}")
Util.escape_zero_byte(key.to_s[-1] == ';' && value.to_s.empty? ? "#{key}" : "#{key}: #{value}")
end
end
end
Expand Down

0 comments on commit 23b3454

Please sign in to comment.