about summary refs log tree commit homepage
path: root/lib/PublicInbox/LeiCurl.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/PublicInbox/LeiCurl.pm')
-rw-r--r--lib/PublicInbox/LeiCurl.pm11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/PublicInbox/LeiCurl.pm b/lib/PublicInbox/LeiCurl.pm
index 38b17c78..f346a1b4 100644
--- a/lib/PublicInbox/LeiCurl.pm
+++ b/lib/PublicInbox/LeiCurl.pm
@@ -8,6 +8,12 @@ use v5.10.1;
 use PublicInbox::Spawn qw(which);
 use PublicInbox::Config;
 
+# Ensures empty strings are quoted, we don't need more
+# sophisticated quoting than for empty strings: curl -d ''
+use overload '""' => sub {
+        join(' ', map { $_ eq '' ?  "''" : $_ } @{$_[0]});
+};
+
 my %lei2curl = (
         'curl-config=s@' => 'config|K=s@',
 );
@@ -63,10 +69,9 @@ EOM
 
 # completes the result of cmd() for $uri
 sub for_uri {
-        my ($self, $lei, $uri) = @_;
+        my ($self, $lei, $uri, @opt) = @_;
         my $pfx = torsocks($self, $lei, $uri) or return; # error
-        [ @$pfx, @$self, substr($uri->path, -3) eq '.gz' ? () : '--compressed',
-                $uri->as_string ]
+        bless [ @$pfx, @$self, @opt, $uri->as_string ], ref($self);
 }
 
 1;