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 716ED1FA12 for ; Sat, 12 Jun 2021 00:10:46 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 5/5] net_reader: canonicalize URL args on add_url Date: Sat, 12 Jun 2021 00:10:45 +0000 Message-Id: <20210612001045.22344-6-e@80x24.org> In-Reply-To: <20210612001045.22344-1-e@80x24.org> References: <20210612001045.22344-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: This fixes cases when users specify an IMAP or NNTP URL with standard port numbers explicitly. In other words, this allows users to use "lei ls-mail-source nntps://public-inbox.org:563/" and "lei ls-mail-source imaps://public-inbox.org:993/" without hitting "BUG:" errors. --- lib/PublicInbox/NetReader.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/PublicInbox/NetReader.pm b/lib/PublicInbox/NetReader.pm index bcc6cbf0..30784199 100644 --- a/lib/PublicInbox/NetReader.pm +++ b/lib/PublicInbox/NetReader.pm @@ -371,8 +371,10 @@ sub add_url { my ($self, $arg, $ls_ok) = @_; my $uri; if ($uri = imap_uri($arg, $ls_ok)) { + $_[1] = $$uri; # canonicalized push @{$self->{imap_order}}, $uri; } elsif ($uri = nntp_uri($arg, $ls_ok)) { + $_[1] = $$uri; # canonicalized push @{$self->{nntp_order}}, $uri; } else { push @{$self->{unsupported_url}}, $arg;