From 66a4a006bce724dfbc69faa51a69f49f8d3d610f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20B=C3=B6ker?= Date: Fri, 8 Mar 2024 22:28:08 +0100 Subject: [PATCH] Don't mess up downloaded content on Windows Set curl STDIN/OUT to :raw, otherwise the CRLF -> LF conversion will mess up the contents. --- lib/HTTP/Tinyish/Curl.pm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/HTTP/Tinyish/Curl.pm b/lib/HTTP/Tinyish/Curl.pm index eb1b0f8..a35dd37 100644 --- a/lib/HTTP/Tinyish/Curl.pm +++ b/lib/HTTP/Tinyish/Curl.pm @@ -58,7 +58,11 @@ sub request { $self->build_options($url, $opts), '--dump-header', $temp, $url, - ], \undef, \$output, \$error; + ], \undef, \$output, \$error, + { + binmode_stdout => ":raw", + binmode_stderr => ":raw", + }; }; if ($@ or $?) { @@ -86,7 +90,11 @@ sub mirror { '--dump-header', $temp, '--remote-time', $url, - ], \undef, \$output, \$error; + ], \undef, \$output, \$error, + { + binmode_stdout => ":raw", + binmode_stderr => ":raw", + }; }; if ($@ or $?) {