user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
* [PATCH] net_reader: quote URL properly for Tor .onion hint
@ 2021-09-18 21:09 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2021-09-18 21:09 UTC (permalink / raw)
  To: meta

The semicolon in ';AUTH=ANONYMOUS' requires quoting in Bourne shell.
---
 lib/PublicInbox/NetReader.pm | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/lib/PublicInbox/NetReader.pm b/lib/PublicInbox/NetReader.pm
index ccfdd261..30b8f810 100644
--- a/lib/PublicInbox/NetReader.pm
+++ b/lib/PublicInbox/NetReader.pm
@@ -71,19 +71,21 @@ sub onion_hint ($$) {
 	my ($lei, $uri) = @_;
 	$uri->host =~ /\.onion\z/i or return "\n";
 	my $t = $uri->isa('PublicInbox::URIimap') ? 'imap' : 'nntp';
-	my $url = uri_section($uri);
+	my $url = PublicInbox::Config::squote_maybe(uri_section($uri));
 	my $set_cfg = 'lei config';
 	if (!$lei) { # public-inbox-watch
-		my $f = $ENV{PI_CONFIG} || '~/.public-inbox/config';
+		my $f = PublicInbox::Config::squote_maybe(
+				$ENV{PI_CONFIG} || '~/.public-inbox/config');
 		$set_cfg = "git config -f $f";
 	}
+	my $dq = substr($url, 0, 1) eq "'" ? '"' : '';
 	<<EOM
 
 Assuming you have Tor configured and running locally on port 9050,
 try configuring a socks5h:// proxy:
 
 	url=$url
-	$set_cfg $t.\$url.proxy socks5h://127.0.0.1:9050
+	$set_cfg $t.$dq\$url$dq.proxy socks5h://127.0.0.1:9050
 
 ...before retrying your current command
 EOM

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-18 21:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-18 21:09 [PATCH] net_reader: quote URL properly for Tor .onion hint Eric Wong

Code repositories for project(s) associated with this 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).