unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 3/8] net_reader: preserve memoized IMAPClient arg for SOCKS
Date: Thu,  9 Sep 2021 05:25:00 +0000	[thread overview]
Message-ID: <20210909052505.7174-4-e@80x24.org> (raw)
In-Reply-To: <20210909052505.7174-1-e@80x24.org>

Multiple invocations of mic_new may happen in long-lived
processes, so do not let mic_new make irreversible changes
to the cached args when using a SOCKS proxy.
---
 lib/PublicInbox/NetReader.pm | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/PublicInbox/NetReader.pm b/lib/PublicInbox/NetReader.pm
index 9faa362c..5199a3a3 100644
--- a/lib/PublicInbox/NetReader.pm
+++ b/lib/PublicInbox/NetReader.pm
@@ -42,16 +42,16 @@ EOM
 
 sub mic_new ($$$$) {
 	my ($self, $mic_arg, $sec, $uri) = @_;
-	my %socks;
+	my %mic_arg = %$mic_arg;
 	my $sa = $self->{imap_opt}->{$sec}->{-proxy_cfg} || $self->{-proxy_cli};
 	if ($sa) {
 		my %opt = %$sa;
-		$opt{ConnectAddr} = delete $mic_arg->{Server};
-		$opt{ConnectPort} = delete $mic_arg->{Port};
-		$socks{Socket} = IO::Socket::Socks->new(%opt) or die
+		$opt{ConnectAddr} = delete $mic_arg{Server};
+		$opt{ConnectPort} = delete $mic_arg{Port};
+		$mic_arg{Socket} = IO::Socket::Socks->new(%opt) or die
 			"E: <$$uri> ".eval('$IO::Socket::Socks::SOCKS_ERROR');
 	}
-	PublicInbox::IMAPClient->new(%$mic_arg, %socks, Keepalive => 1);
+	PublicInbox::IMAPClient->new(%mic_arg, Keepalive => 1);
 }
 
 sub auth_anon_cb { '' }; # for Mail::IMAPClient::Authcallback

  parent reply	other threads:[~2021-09-09  5:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-09  5:24 [PATCH 0/8] net_reader: simplify + fix bugs Eric Wong
2021-09-09  5:24 ` [PATCH 1/8] net_reader: do not set "SSL" fields for non-TLS Eric Wong
2021-09-09  5:24 ` [PATCH 2/8] net_reader: set IMAPClient Keepalive flag late Eric Wong
2021-09-09  5:25 ` Eric Wong [this message]
2021-09-09  5:25 ` [PATCH 4/8] net_reader: nntp_opt => cfg_opt Eric Wong
2021-09-09  5:25 ` [PATCH 5/8] net_reader: imap_opt " Eric Wong
2021-09-09  5:25 ` [PATCH 6/8] net_reader: combine Net::NNTP and IMAPClient args Eric Wong
2021-09-09  5:25 ` [PATCH 7/8] net_reader: improve naming of common args Eric Wong
2021-09-09  5:25 ` [PATCH 8/8] net_reader: support Mail::IMAPClient Ignoresizeerrors Eric Wong

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=20210909052505.7174-4-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.
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).