]> Sergey Matveev's repositories - public-inbox.git/commitdiff
treewide: use --globoff with curl(1)
authorEric Wong <e@80x24.org>
Thu, 29 Sep 2022 17:48:29 +0000 (17:48 +0000)
committerEric Wong <e@80x24.org>
Thu, 29 Sep 2022 18:05:55 +0000 (18:05 +0000)
curl 7.29.0 (on CentOS 7.x) seems to mishandle square-bracketed
IPv6 addresses, at least.  Furthermore, we don't actually need
nor use the globbing in curl for lei when forwarding requests
from the lei command-line.  lei has its own globbing and
`--globoff' behavior for externals and none of it is intended
for curl.

lib/PublicInbox/LeiCurl.pm
t/httpd-corner.t

index 5ffade9976cb43a194e784c955d4b515d2b8a90f..4e602a488c12b48032a7a514faaba83b169f2102 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 
 # common option and torsocks(1) wrapping for curl(1)
@@ -27,7 +27,7 @@ sub new {
        my ($cls, $lei, $curl) = @_;
        $curl //= which('curl') // return $lei->fail('curl not found');
        my $opt = $lei->{opt};
-       my @cmd = ($curl, qw(-Sf));
+       my @cmd = ($curl, qw(-gSf));
        $cmd[-1] .= 's' if $opt->{quiet}; # already the default for "lei q"
        $cmd[-1] .= 'v' if $opt->{verbose}; # we use ourselves, too
        for my $o ($lei->curl_opt) {
index 973cc55df1c6b946576fcf0540b5ba16cfc8e3eb..e16e8dc87364db2de975b1edeefc49ed04a96db9 100644 (file)
@@ -341,7 +341,7 @@ SKIP: {
        my $url = "$base/sha1";
        my ($r, $w);
        pipe($r, $w) or die "pipe: $!";
-       my $cmd = [$curl, qw(--tcp-nodelay -T- -HExpect: -sSN), $url];
+       my $cmd = [$curl, qw(--tcp-nodelay -T- -HExpect: -gsSN), $url];
        open my $cout, '+>', undef or die;
        open my $cerr, '>', undef or die;
        my $rdr = { 0 => $r, 1 => $cout, 2 => $cerr };
@@ -358,7 +358,7 @@ SKIP: {
        seek($cout, 0, SEEK_SET);
        is(<$cout>, sha1_hex($str), 'read expected body');
 
-       my $fh = popen_rd([$curl, '-sS', "$base/async-big"]);
+       my $fh = popen_rd([$curl, '-gsS', "$base/async-big"]);
        my $n = 0;
        my $non_zero = 0;
        while (1) {
@@ -372,12 +372,12 @@ SKIP: {
        is($non_zero, 0, 'read all zeros');
 
        require_mods(@zmods, 4);
-       my $buf = xqx([$curl, '-sS', "$base/psgi-return-gzip"]);
+       my $buf = xqx([$curl, '-gsS', "$base/psgi-return-gzip"]);
        is($?, 0, 'curl succesful');
        IO::Uncompress::Gunzip::gunzip(\$buf => \(my $out));
        is($out, "hello world\n");
        my $curl_rdr = { 2 => \(my $curl_err = '') };
-       $buf = xqx([$curl, qw(-sSv --compressed),
+       $buf = xqx([$curl, qw(-gsSv --compressed),
                        "$base/psgi-return-compressible"], undef, $curl_rdr);
        is($?, 0, 'curl --compressed successful');
        is($buf, "goodbye world\n", 'gzipped response as expected');