]> Sergey Matveev's repositories - public-inbox.git/commitdiff
net_reader: do not set "SSL" fields for non-TLS
authorEric Wong <e@80x24.org>
Thu, 9 Sep 2021 05:24:58 +0000 (05:24 +0000)
committerEric Wong <e@80x24.org>
Thu, 9 Sep 2021 05:42:54 +0000 (05:42 +0000)
This will save a little bit of memory and IPC I/O for users
connecting to localhost and the majority of Tor .onions.

lib/PublicInbox/NetReader.pm

index 08166415cfcb0c6519bd6dd749934a81d54b98a3..b5d14f137d381d62f05b916b94acc519d88308af 100644 (file)
@@ -79,6 +79,7 @@ sub mic_for ($$$$) { # mic = Mail::IMAPClient
                Keepalive => 1, # SO_KEEPALIVE
                %$common, # may set Starttls, Compress, Debug ....
        };
+       $mic_arg->{Ssl} = 1 if $uri->scheme eq 'imaps';
        require PublicInbox::IMAPClient;
        my $mic = mic_new($self, $mic_arg, $sec, $uri) or
                        die "E: <$uri> new: $@\n";
@@ -197,9 +198,9 @@ sub nn_for ($$$$) { # nn = Net::NNTP
        my $nn_arg = {
                Port => $uri->port,
                Host => $host,
-               SSL => $uri->secure, # snews == nntps
                %$common, # may Debug ....
        };
+       $nn_arg->{SSL} = 1 if $uri->secure; # snews == nntps
        my $sa = $self->{-proxy_cli};
        %$nn_arg = (%$nn_arg, %$sa) if $sa;
        my $nn = nn_new($nn_arg, $nntp_opt, $uri);