]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/LeiCurl.pm
nntp: inline CRLF in all response lines
[public-inbox.git] / lib / PublicInbox / LeiCurl.pm
index 69c64cdfb0a5cd90d36ae6273961a96a2bdb73ca..5ffade9976cb43a194e784c955d4b515d2b8a90f 100644 (file)
@@ -55,7 +55,7 @@ sub torsocks { # useful for "git clone" and "git fetch", too
        $opt->{torsocks} = 'false' if $opt->{'no-torsocks'};
        my $torsocks = $opt->{torsocks} //= 'auto';
        if ($torsocks eq 'auto' && substr($uri->host, -6) eq '.onion' &&
-                       (($lei->{env}->{LD_PRELOAD}//'') !~ /torsocks/)) {
+               ($PublicInbox::Config::LD_PRELOAD//'') !~ m!/libtorsocks\b!) {
                # "auto" continues anyways if torsocks is missing;
                # a proxy may be specified via CLI, curlrc,
                # environment variable, or even firewall rule
@@ -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);
 }