* [PATCH 05/13] net_nntp_socks: more comments around how it works
2023-11-09 10:09 4% [PATCH 00/13] misc error handling stuff and simplifications Eric Wong
@ 2023-11-09 10:09 7% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2023-11-09 10:09 UTC (permalink / raw)
To: meta
This is convoluted as hell but I can't figure out a better way
to make Net::NNTP work with SOCKS.
---
lib/PublicInbox/NetNNTPSocks.pm | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/lib/PublicInbox/NetNNTPSocks.pm b/lib/PublicInbox/NetNNTPSocks.pm
index 5b15dd59..306dcacb 100644
--- a/lib/PublicInbox/NetNNTPSocks.pm
+++ b/lib/PublicInbox/NetNNTPSocks.pm
@@ -1,13 +1,13 @@
# Copyright (C) all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
-# wrap Net::NNTP client with SOCKS support
+# wrap Net::NNTP client with SOCKS support. Convoluted, but AFAIK this
+# is the only way to get SOCKS working with Net::NNTP w/o LD_PRELOAD.
package PublicInbox::NetNNTPSocks;
use v5.12;
use Net::NNTP;
-our %OPT;
+our %OPT; # used to pass options between ->new_socks and our ->new
our @ISA = qw(IO::Socket::Socks);
-my @SOCKS_KEYS = qw(ProxyAddr ProxyPort SocksVersion SocksDebug SocksResolve);
# use this instead of Net::NNTP->new if using Proxy*
sub new_socks {
@@ -16,9 +16,10 @@ sub new_socks {
local @Net::NNTP::ISA = (qw(Net::Cmd), __PACKAGE__);
local %OPT = map {;
defined($opt{$_}) ? ($_ => $opt{$_}) : ()
- } @SOCKS_KEYS;
+ } qw(ProxyAddr ProxyPort SocksVersion SocksDebug SocksResolve);
no warnings 'uninitialized'; # needed for $SOCKS_ERROR
- Net::NNTP->new(%opt) // die "errors: \$!=$! SOCKS=",
+ my $ret = Net::NNTP->new(%opt); # calls PublicInbox::NetNNTPSocks::new
+ $ret // die "errors: \$!=$! SOCKS=",
eval('$IO::Socket::Socks::SOCKS_ERROR // ""'),
', SSL=',
(eval('IO::Socket::SSL->errstr') // ''), "\n";
^ permalink raw reply related [relevance 7%]
* [PATCH 00/13] misc error handling stuff and simplifications
@ 2023-11-09 10:09 4% Eric Wong
2023-11-09 10:09 7% ` [PATCH 05/13] net_nntp_socks: more comments around how it works Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2023-11-09 10:09 UTC (permalink / raw)
To: meta
1-4 were things I noticed while chasing the lei SIGPIPE handling
fix. 5-7 are things I noticed while testing on Dragonfly and
NetBSD. 8 was noticed randomly while working on a new mirror,
and the last few complete the work which let me get rid of tied
IO handles in favor of using the PublicInbox::IO subclass.
Eric Wong (13):
lei_xsearch: put query in process title for debugging
lei: use cached $daemon_pid when possible
lei: reuse FDs atfork and close explicitly
lei_up: use v5.12
net_nntp_socks: more comments around how it works
lei ls-mail-source: gracefully handle network failures
net: retry on EINTR and check for {quit} flag
lei_mirror: note missing local manifests are non-fatal
ipc: simplify partial sendmsg fallback
lei_input: always close single `eml' inputs
xapcmd: get rid of scalar wantarray popen_rd
lei: get rid of autoreap usage
spawn: get rid of wantarray popen_rd/popen_wr
lib/PublicInbox/IPC.pm | 13 ++------
lib/PublicInbox/LEI.pm | 11 ++++---
lib/PublicInbox/LeiInput.pm | 26 +++++++--------
lib/PublicInbox/LeiLsMailSource.pm | 6 ++--
lib/PublicInbox/LeiMirror.pm | 5 +--
lib/PublicInbox/LeiRemote.pm | 14 ++++----
lib/PublicInbox/LeiUp.pm | 10 +++---
lib/PublicInbox/LeiXSearch.pm | 27 ++++++++-------
lib/PublicInbox/NetNNTPSocks.pm | 12 ++++---
lib/PublicInbox/NetReader.pm | 53 +++++++++++++++++++++---------
lib/PublicInbox/Spawn.pm | 6 ++--
lib/PublicInbox/TestCommon.pm | 23 ++++++++++++-
lib/PublicInbox/Watch.pm | 2 +-
lib/PublicInbox/Xapcmd.pm | 12 +++----
t/io.t | 8 +----
t/ipc.t | 7 ++++
t/lei-import.t | 27 +++++++++++++++
17 files changed, 163 insertions(+), 99 deletions(-)
^ permalink raw reply [relevance 4%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2023-11-09 10:09 4% [PATCH 00/13] misc error handling stuff and simplifications Eric Wong
2023-11-09 10:09 7% ` [PATCH 05/13] net_nntp_socks: more comments around how it works Eric Wong
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).