From: Eric Wong Date: Wed, 3 Nov 2021 20:35:55 +0000 (+0000) Subject: lei_curl: use http.proxy knob via URL match for curl X-Git-Tag: v1.7.0~4 X-Git-Url: http://www.git.stargrave.org/?p=public-inbox.git;a=commitdiff_plain;h=afd4be5163b39050ac9892b8a511f11f417acf7b lei_curl: use http.proxy knob via URL match for curl Using the --proxy on the command-line affects the entire lei invocation, and users searching HTTP(S) remotes and writing to an IMAP folder may want more fine-grained proxy use: lei q -o imap://no-proxy.example/foo -O https://need-proxy.example/bar ... --- diff --git a/lib/PublicInbox/LeiCurl.pm b/lib/PublicInbox/LeiCurl.pm index ce57e796..5ffade99 100644 --- a/lib/PublicInbox/LeiCurl.pm +++ b/lib/PublicInbox/LeiCurl.pm @@ -75,6 +75,11 @@ EOM sub for_uri { my ($self, $lei, $uri, @opt) = @_; my $pfx = torsocks($self, $lei, $uri) or return; # error + if ($uri->scheme =~ /\Ahttps?\z/i) { + my $cfg = $lei->_lei_cfg; + my $p = $cfg ? $cfg->urlmatch('http.Proxy', $$uri) : undef; + push(@opt, "--proxy=$p") if defined($p); + } bless [ @$pfx, @$self, @opt, $uri->as_string ], ref($self); }