about summary refs log tree commit homepage
path: root/lib/PublicInbox/LeiCurl.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-02-07 23:05:09 -1000
committerEric Wong <e@80x24.org>2021-02-08 22:07:40 +0000
commit0df6f43c81c72924020b8f71c696784f154d93fa (patch)
tree0480da99726a254a2bf71ee05d7d072c1201c045 /lib/PublicInbox/LeiCurl.pm
parent68250ff1c247bb737e6daef1af31dcd7fa918644 (diff)
downloadpublic-inbox-0df6f43c81c72924020b8f71c696784f154d93fa.tar.gz
For early MUA spawners using lock-free outputs, we we need to
on the startq pipe to silence progress reporting.  For
--augment users, we can start the MUA even earlier by
creating Maildirs in the pre-augment phase.

To improve progress reporting for non-MUA (or late-MUA)
spawners, we'll no longer blindly append "--compressed" to the
curl(1) command when POST-ing for the gzipped mboxrd.
Furthermore, we'll overload stringify ('""') in LeiCurl to
ensure the empty -d '' string shows up properly.

v2: fix startq waiting with --threads
    mset_progress is never shown with early MUA spawning,
    The plan is to still show progress when augmenting and
    deduping.  This fixes all local search cases.
    A leftover debug bit is dropped, too
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;