user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 5/5] lei q: continue remote search if torsocks(1) is missing
Date: Sun, 24 Jan 2021 17:18:57 -0800	[thread overview]
Message-ID: <20210125011857.563-6-e@80x24.org> (raw)
In-Reply-To: <20210125011857.563-1-e@80x24.org>

torsocks is just one of many ways to get curl to use Tor,
so we'll continue if we can't find torsocks in our PATH
and assume the user has a proxy configured via curlrc,
the command-line, environment variable, or even firewall
rules.
---
 lib/PublicInbox/LeiXSearch.pm | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/PublicInbox/LeiXSearch.pm b/lib/PublicInbox/LeiXSearch.pm
index 369f6f89..b470c113 100644
--- a/lib/PublicInbox/LeiXSearch.pm
+++ b/lib/PublicInbox/LeiXSearch.pm
@@ -228,10 +228,16 @@ sub query_remote_mboxrd {
 		my $cmd = [ @cmd, $uri->as_string ];
 		if ($tor eq 'auto' && substr($uri->host, -6) eq '.onion' &&
 				(($env->{LD_PRELOAD}//'') !~ /torsocks/)) {
-			unshift @$cmd, 'torsocks';
+			unshift @$cmd, which('torsocks');
 		} elsif (PublicInbox::Config::git_bool($tor)) {
-			unshift @$cmd, 'torsocks';
+			unshift @$cmd, which('torsocks');
 		}
+
+		# continue anyways if torsocks is missing; a proxy may be
+		# specified via CLI, curlrc, environment variable, or even
+		# firewall rule
+		shift(@$cmd) if !$cmd->[0];
+
 		$lei->err("# @$cmd") if $verbose;
 		$? = 0;
 		my $fh = popen_rd($cmd, $env, $rdr);

      parent reply	other threads:[~2021-01-25  1:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-25  1:18 [PATCH 0/5] lei: more fixes and usability enhancement Eric Wong
2021-01-25  1:18 ` [PATCH 1/5] lei: reinstate JSON smsg output deduplication Eric Wong
2021-01-25  1:18 ` [PATCH 2/5] lei q: drop "oid" output format Eric Wong
2021-01-25  1:18 ` [PATCH 3/5] lei q: demangle and quiet curl output Eric Wong
2021-01-25  1:18 ` [PATCH 4/5] lei q: reject remotes early if curl(1) is missing Eric Wong
2021-01-25  1:18 ` Eric Wong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210125011857.563-6-e@80x24.org \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).