From c1a92bf7adccea821a905b221972c06fc5579718 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 24 Feb 2021 17:31:51 +0600 Subject: add PublicInbox::URInntps package We prefer the IANA-registered form of URIs to avoid confusing users, but the URI package has yet to support it. cf. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=983419 --- lib/PublicInbox/URInntps.pm | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 lib/PublicInbox/URInntps.pm (limited to 'lib/PublicInbox/URInntps.pm') diff --git a/lib/PublicInbox/URInntps.pm b/lib/PublicInbox/URInntps.pm new file mode 100644 index 00000000..69fe7163 --- /dev/null +++ b/lib/PublicInbox/URInntps.pm @@ -0,0 +1,17 @@ +# Copyright (C) 2021 all contributors +# License: AGPL-3.0+ + +# deal with the lack of URI::nntps in upstream URI. +# nntps is IANA registered, snews is deprecated +# cf. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=983419 +package PublicInbox::URInntps; +use strict; +use parent qw(URI::snews); +use URI; + +sub new { + my ($class, $url) = @_; + $url =~ m!\Anntps://!i ? bless(\$url, $class) : URI->new($url); +} + +1; -- cgit v1.2.3-24-ge0c7