From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 127A91FB0F for ; Sat, 18 Sep 2021 09:33:34 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 6/9] net_reader: detect IMAP failures earlier Date: Sat, 18 Sep 2021 09:33:29 +0000 Message-Id: <20210918093332.16054-7-e@80x24.org> In-Reply-To: <20210918093332.16054-1-e@80x24.org> References: <20210918093332.16054-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: An Mail::IMAPClient object may be returned even on connection failure, so use IsConnected to check for it. This ensures git-credential will no longer prompt for passwords when there's no connection. --- lib/PublicInbox/NetReader.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/PublicInbox/NetReader.pm b/lib/PublicInbox/NetReader.pm index e703cddb..8eff847e 100644 --- a/lib/PublicInbox/NetReader.pm +++ b/lib/PublicInbox/NetReader.pm @@ -108,7 +108,8 @@ sub mic_for ($$$$) { # mic = Mail::IMAPClient }; $mic_arg->{Ssl} = 1 if $uri->scheme eq 'imaps'; require PublicInbox::IMAPClient; - my $mic = mic_new($self, $mic_arg, $sec, $uri) or + my $mic = mic_new($self, $mic_arg, $sec, $uri); + ($mic && $mic->IsConnected) or die "E: <$uri> new: $@".onion_hint($lei, $uri); # default to using STARTTLS if it's available, but allow