From afd4be5163b39050ac9892b8a511f11f417acf7b Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 3 Nov 2021 20:35:55 +0000 Subject: 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 ... --- lib/PublicInbox/LeiCurl.pm | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/PublicInbox') 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); } -- cgit v1.2.3-24-ge0c7