From d2051b9c00d28a99726528e580adeb88c0496a5b Mon Sep 17 00:00:00 2001 From: Brendan Byrd Date: Thu, 17 Apr 2014 19:33:34 -0400 Subject: [PATCH 1/9] Add scp scheme as an alias of ssh --- lib/URI/scp.pm | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 lib/URI/scp.pm diff --git a/lib/URI/scp.pm b/lib/URI/scp.pm new file mode 100644 index 00000000..1c876573 --- /dev/null +++ b/lib/URI/scp.pm @@ -0,0 +1,5 @@ +package URI::scp; +require URI::ssh; +@ISA=qw(URI::ssh); + +1; From a0a8f77f010570519d2aefe48ab2b0124a3f7244 Mon Sep 17 00:00:00 2001 From: Brendan Byrd Date: Fri, 18 Apr 2014 09:09:58 -0400 Subject: [PATCH 2/9] Add ftps scheme --- lib/URI/ftps.pm | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 lib/URI/ftps.pm diff --git a/lib/URI/ftps.pm b/lib/URI/ftps.pm new file mode 100644 index 00000000..e2a22a52 --- /dev/null +++ b/lib/URI/ftps.pm @@ -0,0 +1,10 @@ +package URI::ftps; + +require URI::ftp; +@ISA=qw(URI::ftp); + +sub default_port { 990 } + +sub secure { 1 } + +1; From 5da8206f35fafc0c6c96559b00c5901468c8ee98 Mon Sep 17 00:00:00 2001 From: Brendan Byrd Date: Fri, 18 Apr 2014 09:10:43 -0400 Subject: [PATCH 3/9] Add irc/ircs schemes --- lib/URI/irc.pm | 140 ++++++++++++++++++++++++++++++++++++++++++++++++ lib/URI/ircs.pm | 10 ++++ t/irc.t | 43 +++++++++++++++ 3 files changed, 193 insertions(+) create mode 100644 lib/URI/irc.pm create mode 100644 lib/URI/ircs.pm create mode 100644 t/irc.t diff --git a/lib/URI/irc.pm b/lib/URI/irc.pm new file mode 100644 index 00000000..be23f934 --- /dev/null +++ b/lib/URI/irc.pm @@ -0,0 +1,140 @@ +package URI::irc; # draft-butcher-irc-url-04 + +require URI::_login; +@ISA=qw(URI::_login); + +use strict; + +use overload ( + '""' => sub { $_[0]->as_string }, + '==' => sub { URI::_obj_eq(@_) }, + '!=' => sub { !URI::_obj_eq(@_) }, + fallback => 1, +); + +sub default_port { 6667 } + +# ircURL = ircURI "://" location "/" [ entity ] [ flags ] [ options ] +# ircURI = "irc" / "ircs" +# location = [ authinfo "@" ] hostport +# authinfo = [ username ] [ ":" password ] +# username = *( escaped / unreserved ) +# password = *( escaped / unreserved ) [ ";" passtype ] +# passtype = *( escaped / unreserved ) +# entity = [ "#" ] *( escaped / unreserved ) +# flags = ( [ "," enttype ] [ "," hosttype ] ) +# /= ( [ "," hosttype ] [ "," enttype ] ) +# enttype = "," ( "isuser" / "ischannel" ) +# hosttype = "," ( "isserver" / "isnetwork" ) +# options = "?" option *( "&" option ) +# option = optname [ "=" optvalue ] +# optname = *( ALPHA / "-" ) +# optvalue = optparam *( "," optparam ) +# optparam = *( escaped / unreserved ) + +# XXX: Technically, passtype is part of the protocol, but is rarely used and +# not defined in the RFC beyond the URL ABNF. + +# Starting the entity with /# is okay per spec, but it needs to be encoded to +# %23 for the URL::_generic::path operations to parse correctly. +sub _init { + my $class = shift; + my $self = $class->SUPER::_init(@_); + $$self =~ s|^((?:[^:/?\#]+:)?(?://[^/?\#]*)?)/\#|$1/%23|s; + $self; +} + +# Return the /# form, since this is most common for channel names. +sub path { + my $self = shift; + my ($new) = @_; + $new =~ s|^/\#|/%23| if (@_ && defined $new); + my $val = $self->SUPER::path(@_ ? $new : ()); + $val =~ s|^/%23|/\#|; + $val; +} +sub path_query { + my $self = shift; + my ($new) = @_; + $new =~ s|^/\#|/%23| if (@_ && defined $new); + my $val = $self->SUPER::path_query(@_ ? $new : ()); + $val =~ s|^/%23|/\#|; + $val; +} +sub as_string { + my $self = shift; + my $val = $self->SUPER::as_string; + $val =~ s|^((?:[^:/?\#]+:)?(?://[^/?\#]*)?)/%23|$1/\#|s; + $val; +} + +sub entity { + my $self = shift; + + my $path = $self->path; + $path =~ s|^/||; + my ($entity, @flags) = split /,/, $path; + + if (@_) { + my $new = shift; + $new = '' unless defined $new; + $self->path( '/'.join(',', $new, @flags) ); + } + + return unless length $entity; + $entity; +} + +sub flags { + my $self = shift; + + my $path = $self->path; + $path =~ s|^/||; + my ($entity, @flags) = split /,/, $path; + + if (@_) { + $self->path( '/'.join(',', $entity, @_) ); + } + + @flags; +} + +sub options { shift->query_form(@_) } + +sub canonical { + my $self = shift; + my $other = $self->SUPER::canonical; + + # Clean up the flags + my $path = $other->path; + $path =~ s|^/||; + my ($entity, @flags) = split /,/, $path; + + my @clean = + map { $_ eq 'isnick' ? 'isuser' : $_ } # convert isnick->isuser + map { lc } + # NOTE: Allow flags from draft-mirashi-url-irc-01 as well + grep { /^(?:is(?:user|channel|server|network|nick)|need(?:pass|key))$/i } + @flags + ; + + # Only allow the first type of each category, per the Butcher draft + my ($enttype) = grep { /^is(?:user|channel)$/ } @clean; + my ($hosttype) = grep { /^is(?:server|network)$/ } @clean; + my @others = grep { /^need(?:pass|key)$/ } @clean; + + my @new = ( + $enttype ? $enttype : (), + $hosttype ? $hosttype : (), + @others, + ); + + unless (join(',', @new) eq join(',', @flags)) { + $other = $other->clone if $other == $self; + $other->path( '/'.join(',', $entity, @new) ); + } + + $other; +} + +1; diff --git a/lib/URI/ircs.pm b/lib/URI/ircs.pm new file mode 100644 index 00000000..f6a1e258 --- /dev/null +++ b/lib/URI/ircs.pm @@ -0,0 +1,10 @@ +package URI::ircs; + +require URI::irc; +@ISA=qw(URI::irc); + +sub default_port { 994 } + +sub secure { 1 } + +1; diff --git a/t/irc.t b/t/irc.t new file mode 100644 index 00000000..aa5a7242 --- /dev/null +++ b/t/irc.t @@ -0,0 +1,43 @@ +use strict; +use warnings; + +use Test::More tests => 12; + +use URI (); +my $uri; + +$uri = URI->new("irc://PerlUser\@irc.perl.org:6669/#libwww-perl,ischannel,isnetwork?key=bazqux"); + +is($uri, "irc://PerlUser\@irc.perl.org:6669/#libwww-perl,ischannel,isnetwork?key=bazqux"); + +is($uri->port, 6669); + +# add a password +$uri->password('foobar'); +is($uri->userinfo, "PerlUser:foobar"); + +my @opts = $uri->options; +is_deeply(\@opts, [qw< key bazqux >]); + +$uri->options(foo => "bar", bar => "baz"); +is($uri->query, "foo=bar&bar=baz"); + +is($uri->host, "irc.perl.org"); + +is($uri->path, "/#libwww-perl,ischannel,isnetwork"); + +# add a bunch of flags to clean up +$uri->path("/SineSwiper,isnick,isnetwork,isserver,needpass,needkey"); +$uri = $uri->canonical; + +is($uri->path, "/SineSwiper,isuser,isnetwork,needpass,needkey"); + +# ports and secure-ness +is($uri->secure, 0); + +$uri->port(undef); +is($uri->port, 6667); + +$uri->scheme("ircs"); +is($uri->port, 994); +is($uri->secure, 1); From b9d008153fc1213800654b1ed8d2c9be7bf9987b Mon Sep 17 00:00:00 2001 From: Brendan Byrd Date: Mon, 9 Feb 2015 12:07:54 -0500 Subject: [PATCH 4/9] Add ftpes scheme, and encrypt_mode to ftp/ftps/ftpes --- lib/URI/ftp.pm | 2 ++ lib/URI/ftpes.pm | 10 ++++++++++ lib/URI/ftps.pm | 2 ++ t/ftp.t | 27 ++++++++++++++++++++++++++- 4 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 lib/URI/ftpes.pm diff --git a/lib/URI/ftp.pm b/lib/URI/ftp.pm index 7668050d..f42eb7df 100644 --- a/lib/URI/ftp.pm +++ b/lib/URI/ftp.pm @@ -9,6 +9,8 @@ use parent qw(URI::_server URI::_userpass); sub default_port { 21 } +sub encrypt_mode { undef } + sub path { shift->path_query(@_) } # XXX sub _user { shift->SUPER::user(@_); } diff --git a/lib/URI/ftpes.pm b/lib/URI/ftpes.pm new file mode 100644 index 00000000..327b584f --- /dev/null +++ b/lib/URI/ftpes.pm @@ -0,0 +1,10 @@ +package URI::ftpes; + +require URI::ftp; +@ISA=qw(URI::ftp); + +sub secure { 1 } + +sub encrypt_mode { 'explicit' } + +1; diff --git a/lib/URI/ftps.pm b/lib/URI/ftps.pm index e2a22a52..6cfe773f 100644 --- a/lib/URI/ftps.pm +++ b/lib/URI/ftps.pm @@ -7,4 +7,6 @@ sub default_port { 990 } sub secure { 1 } +sub encrypt_mode { 'implicit' } + 1; diff --git a/t/ftp.t b/t/ftp.t index d6d97b18..3abbe271 100644 --- a/t/ftp.t +++ b/t/ftp.t @@ -1,7 +1,7 @@ use strict; use warnings; -use Test::More tests => 13; +use Test::More tests => 23; use URI (); my $uri; @@ -14,6 +14,10 @@ is($uri->host, "ftp.example.com"); is($uri->port, 21); +is($uri->secure, 0); + +is($uri->encrypt_mode, undef); + is($uri->user, "anonymous"); is($uri->password, 'anonymous@'); @@ -31,6 +35,7 @@ $uri->password("secret"); is($uri, "ftp://gisle%40aas.no:secret\@ftp.example.com/path"); $uri = URI->new("ftp://gisle\@aas.no:secret\@ftp.example.com/path"); + is($uri, "ftp://gisle\@aas.no:secret\@ftp.example.com/path"); is($uri->userinfo, "gisle\@aas.no:secret"); @@ -38,3 +43,23 @@ is($uri->userinfo, "gisle\@aas.no:secret"); is($uri->user, "gisle\@aas.no"); is($uri->password, "secret"); + +$uri = URI->new("ftps://ftp.example.com/path"); + +is($uri->scheme, "ftps"); + +is($uri->port, 990); + +is($uri->secure, 1); + +is($uri->encrypt_mode, 'implicit'); + +$uri = URI->new("ftpes://ftp.example.com/path"); + +is($uri->scheme, "ftpes"); + +is($uri->port, 21); + +is($uri->secure, 1); + +is($uri->encrypt_mode, 'explicit'); From 05a0330ae000087775259c4ca005b2e7c953486b Mon Sep 17 00:00:00 2001 From: Brendan Byrd Date: Fri, 23 Aug 2024 16:36:40 -0400 Subject: [PATCH 5/9] Modernize and document new modules/methods --- dist.ini | 5 ++++- lib/URI.pm | 12 ++++++++++++ lib/URI/ftpes.pm | 8 ++++++-- lib/URI/ftps.pm | 8 ++++++-- lib/URI/irc.pm | 8 +++++--- lib/URI/ircs.pm | 8 ++++++-- lib/URI/scp.pm | 9 +++++++-- 7 files changed, 46 insertions(+), 12 deletions(-) diff --git a/dist.ini b/dist.ini index 3bfafa50..411a8a8c 100644 --- a/dist.ini +++ b/dist.ini @@ -91,6 +91,9 @@ skip = URI::_idna skip = URI::_login skip = URI::_ldap skip = URI::file::QNX +skip = URI::ftpes +skip = URI::ftps +skip = URI::irc skip = URI::nntp skip = URI::urn::isbn skip = URI::urn::oid @@ -111,7 +114,7 @@ trustme = URI::file::Mac => qr/^(?:dir|file)$/ trustme = URI::file::OS2 => qr/^(?:file)$/ trustme = URI::file::Unix => qr/^(?:file)$/ trustme = URI::file::Win32 => qr/^(?:file|fix_path)$/ -trustme = URI::ftp => qr/^(?:password|user)$/ +trustme = URI::ftp => qr/^(?:password|user|encrypt_mode)$/ trustme = URI::gopher => qr/^(?:gopher_type|gtype|search|selector|string)$/ trustme = URI::ldapi => qr/^(?:un_path)$/ trustme = URI::mailto => qr/^(?:headers|to)$/ diff --git a/lib/URI.pm b/lib/URI.pm index 0a3d682d..66f707d6 100644 --- a/lib/URI.pm +++ b/lib/URI.pm @@ -970,6 +970,9 @@ C objects belonging to the ftp scheme support the common, generic and server methods. In addition, they provide two methods for accessing the userinfo sub-components: $uri->user and $uri->password. +It also supports accessing to the encryption mode ($uri->encrypt_mode), +which has its own defaults for I and I URI schemes. + =item B: The I URI scheme is specified in @@ -1020,6 +1023,15 @@ The scheme is used to reference ICAP servers through SSL connections. Its syntax is the same as icap, including the same default port. +=item B: + +The I URI scheme is specified in L. +The scheme is used to reference IRC servers and their resources. + +C objects belonging to the irc or ircs scheme support login +methods, and the following IRC-specific ones: $uri->entity, +$uri->flags, $uri->options. + =item B: The I URI scheme is specified in RFC 2255. LDAP is the diff --git a/lib/URI/ftpes.pm b/lib/URI/ftpes.pm index 327b584f..54917da9 100644 --- a/lib/URI/ftpes.pm +++ b/lib/URI/ftpes.pm @@ -1,7 +1,11 @@ package URI::ftpes; -require URI::ftp; -@ISA=qw(URI::ftp); +use strict; +use warnings; + +our $VERSION = '5.29'; + +use parent 'URI::ftp'; sub secure { 1 } diff --git a/lib/URI/ftps.pm b/lib/URI/ftps.pm index 6cfe773f..5b92a592 100644 --- a/lib/URI/ftps.pm +++ b/lib/URI/ftps.pm @@ -1,7 +1,11 @@ package URI::ftps; -require URI::ftp; -@ISA=qw(URI::ftp); +use strict; +use warnings; + +our $VERSION = '5.29'; + +use parent 'URI::ftp'; sub default_port { 990 } diff --git a/lib/URI/irc.pm b/lib/URI/irc.pm index be23f934..48a3b273 100644 --- a/lib/URI/irc.pm +++ b/lib/URI/irc.pm @@ -1,9 +1,11 @@ package URI::irc; # draft-butcher-irc-url-04 -require URI::_login; -@ISA=qw(URI::_login); - use strict; +use warnings; + +our $VERSION = '5.29'; + +use parent 'URI::_login'; use overload ( '""' => sub { $_[0]->as_string }, diff --git a/lib/URI/ircs.pm b/lib/URI/ircs.pm index f6a1e258..8d40848e 100644 --- a/lib/URI/ircs.pm +++ b/lib/URI/ircs.pm @@ -1,7 +1,11 @@ package URI::ircs; -require URI::irc; -@ISA=qw(URI::irc); +use strict; +use warnings; + +our $VERSION = '5.29'; + +use parent 'URI::irc'; sub default_port { 994 } diff --git a/lib/URI/scp.pm b/lib/URI/scp.pm index 1c876573..f73ea22d 100644 --- a/lib/URI/scp.pm +++ b/lib/URI/scp.pm @@ -1,5 +1,10 @@ package URI::scp; -require URI::ssh; -@ISA=qw(URI::ssh); + +use strict; +use warnings; + +our $VERSION = '5.29'; + +use parent 'URI::ssh'; 1; From ff02b2b1e98d6f84c4084e240a36713fc591ac7f Mon Sep 17 00:00:00 2001 From: Brendan Byrd Date: Fri, 23 Aug 2024 16:38:56 -0400 Subject: [PATCH 6/9] Add another POD coverage skip --- dist.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/dist.ini b/dist.ini index 411a8a8c..81795eb1 100644 --- a/dist.ini +++ b/dist.ini @@ -97,6 +97,7 @@ skip = URI::irc skip = URI::nntp skip = URI::urn::isbn skip = URI::urn::oid +skip = URI::scp skip = URI::sftp trustme = URI => qr/^(?:STORABLE_freeze|STORABLE_thaw|TO_JSON|implementor)$/ trustme = URI::Escape => qr/^(?:escape_char)$/ From 3e5c6140f14ab4f2d4e5312d6c5a732e895e776b Mon Sep 17 00:00:00 2001 From: Brendan Byrd Date: Tue, 8 Oct 2024 13:49:20 -0400 Subject: [PATCH 7/9] Split up secure protocol tests to their own unit test file --- t/ftp.t | 33 +-------------------------------- t/ftpes.t | 14 ++++++++++++++ t/ftps.t | 14 ++++++++++++++ t/irc.t | 11 +++-------- t/ircs.t | 14 ++++++++++++++ 5 files changed, 46 insertions(+), 40 deletions(-) create mode 100644 t/ftpes.t create mode 100644 t/ftps.t create mode 100644 t/ircs.t diff --git a/t/ftp.t b/t/ftp.t index 3abbe271..e0d09a19 100644 --- a/t/ftp.t +++ b/t/ftp.t @@ -1,7 +1,7 @@ use strict; use warnings; -use Test::More tests => 23; +use Test::More tests => 15; use URI (); my $uri; @@ -9,25 +9,17 @@ my $uri; $uri = URI->new("ftp://ftp.example.com/path"); is($uri->scheme, "ftp"); - is($uri->host, "ftp.example.com"); - is($uri->port, 21); - is($uri->secure, 0); - is($uri->encrypt_mode, undef); - is($uri->user, "anonymous"); - is($uri->password, 'anonymous@'); $uri->userinfo("gisle\@aas.no"); is($uri, "ftp://gisle%40aas.no\@ftp.example.com/path"); - is($uri->user, "gisle\@aas.no"); - is($uri->password, undef); $uri->password("secret"); @@ -37,29 +29,6 @@ is($uri, "ftp://gisle%40aas.no:secret\@ftp.example.com/path"); $uri = URI->new("ftp://gisle\@aas.no:secret\@ftp.example.com/path"); is($uri, "ftp://gisle\@aas.no:secret\@ftp.example.com/path"); - is($uri->userinfo, "gisle\@aas.no:secret"); - is($uri->user, "gisle\@aas.no"); - is($uri->password, "secret"); - -$uri = URI->new("ftps://ftp.example.com/path"); - -is($uri->scheme, "ftps"); - -is($uri->port, 990); - -is($uri->secure, 1); - -is($uri->encrypt_mode, 'implicit'); - -$uri = URI->new("ftpes://ftp.example.com/path"); - -is($uri->scheme, "ftpes"); - -is($uri->port, 21); - -is($uri->secure, 1); - -is($uri->encrypt_mode, 'explicit'); diff --git a/t/ftpes.t b/t/ftpes.t new file mode 100644 index 00000000..e0cd2cc1 --- /dev/null +++ b/t/ftpes.t @@ -0,0 +1,14 @@ +use strict; +use warnings; + +use Test::More tests => 4; + +use URI (); +my $uri; + +$uri = URI->new("ftpes://ftp.example.com/path"); + +is($uri->scheme, 'ftpes'); +is($uri->port, 21); +is($uri->secure, 1); +is($uri->encrypt_mode, 'explicit'); diff --git a/t/ftps.t b/t/ftps.t new file mode 100644 index 00000000..e537af8c --- /dev/null +++ b/t/ftps.t @@ -0,0 +1,14 @@ +use strict; +use warnings; + +use Test::More tests => 4; + +use URI (); +my $uri; + +$uri = URI->new("ftps://ftp.example.com/path"); + +is($uri->scheme, 'ftps'); +is($uri->port, 990); +is($uri->secure, 1); +is($uri->encrypt_mode, 'implicit'); diff --git a/t/irc.t b/t/irc.t index aa5a7242..c5c0ab9e 100644 --- a/t/irc.t +++ b/t/irc.t @@ -1,7 +1,7 @@ use strict; use warnings; -use Test::More tests => 12; +use Test::More tests => 10; use URI (); my $uri; @@ -9,21 +9,20 @@ my $uri; $uri = URI->new("irc://PerlUser\@irc.perl.org:6669/#libwww-perl,ischannel,isnetwork?key=bazqux"); is($uri, "irc://PerlUser\@irc.perl.org:6669/#libwww-perl,ischannel,isnetwork?key=bazqux"); - is($uri->port, 6669); # add a password $uri->password('foobar'); + is($uri->userinfo, "PerlUser:foobar"); my @opts = $uri->options; is_deeply(\@opts, [qw< key bazqux >]); $uri->options(foo => "bar", bar => "baz"); -is($uri->query, "foo=bar&bar=baz"); +is($uri->query, "foo=bar&bar=baz"); is($uri->host, "irc.perl.org"); - is($uri->path, "/#libwww-perl,ischannel,isnetwork"); # add a bunch of flags to clean up @@ -37,7 +36,3 @@ is($uri->secure, 0); $uri->port(undef); is($uri->port, 6667); - -$uri->scheme("ircs"); -is($uri->port, 994); -is($uri->secure, 1); diff --git a/t/ircs.t b/t/ircs.t new file mode 100644 index 00000000..993f2299 --- /dev/null +++ b/t/ircs.t @@ -0,0 +1,14 @@ +use strict; +use warnings; + +use Test::More tests => 4; + +use URI (); +my $uri; + +$uri = URI->new("ircs://PerlUser\@irc.perl.org"); + +is($uri, "ircs://PerlUser\@irc.perl.org"); +is($uri->scheme, 'ircs'); +is($uri->port, 994); +is($uri->secure, 1); From 23fc023bfa50dba62ee499df67e452bd4874c04b Mon Sep 17 00:00:00 2001 From: Brendan Byrd Date: Tue, 8 Oct 2024 14:11:53 -0400 Subject: [PATCH 8/9] Version corrections after rebase --- lib/URI/ftpes.pm | 2 +- lib/URI/ftps.pm | 2 +- lib/URI/irc.pm | 2 +- lib/URI/ircs.pm | 2 +- lib/URI/scp.pm | 2 +- lib/URI/sftp.pm | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/URI/ftpes.pm b/lib/URI/ftpes.pm index 54917da9..3a3db046 100644 --- a/lib/URI/ftpes.pm +++ b/lib/URI/ftpes.pm @@ -3,7 +3,7 @@ package URI::ftpes; use strict; use warnings; -our $VERSION = '5.29'; +our $VERSION = '5.30'; use parent 'URI::ftp'; diff --git a/lib/URI/ftps.pm b/lib/URI/ftps.pm index 5b92a592..d19dc42f 100644 --- a/lib/URI/ftps.pm +++ b/lib/URI/ftps.pm @@ -3,7 +3,7 @@ package URI::ftps; use strict; use warnings; -our $VERSION = '5.29'; +our $VERSION = '5.30'; use parent 'URI::ftp'; diff --git a/lib/URI/irc.pm b/lib/URI/irc.pm index 48a3b273..d98b2f8e 100644 --- a/lib/URI/irc.pm +++ b/lib/URI/irc.pm @@ -3,7 +3,7 @@ package URI::irc; # draft-butcher-irc-url-04 use strict; use warnings; -our $VERSION = '5.29'; +our $VERSION = '5.30'; use parent 'URI::_login'; diff --git a/lib/URI/ircs.pm b/lib/URI/ircs.pm index 8d40848e..0154874e 100644 --- a/lib/URI/ircs.pm +++ b/lib/URI/ircs.pm @@ -3,7 +3,7 @@ package URI::ircs; use strict; use warnings; -our $VERSION = '5.29'; +our $VERSION = '5.30'; use parent 'URI::irc'; diff --git a/lib/URI/scp.pm b/lib/URI/scp.pm index f73ea22d..ea70d779 100644 --- a/lib/URI/scp.pm +++ b/lib/URI/scp.pm @@ -3,7 +3,7 @@ package URI::scp; use strict; use warnings; -our $VERSION = '5.29'; +our $VERSION = '5.30'; use parent 'URI::ssh'; diff --git a/lib/URI/sftp.pm b/lib/URI/sftp.pm index 3b649c0f..3828e2a2 100644 --- a/lib/URI/sftp.pm +++ b/lib/URI/sftp.pm @@ -3,8 +3,8 @@ package URI::sftp; use strict; use warnings; -use parent 'URI::ssh'; - our $VERSION = '5.30'; +use parent 'URI::ssh'; + 1; From 85d1bfc45d1c1bd178e77e7b933690623ca351e9 Mon Sep 17 00:00:00 2001 From: Brendan Byrd Date: Tue, 8 Oct 2024 14:24:44 -0400 Subject: [PATCH 9/9] Add unit tests for ssh, sftp, scp --- t/scp.t | 16 ++++++++++++++++ t/sftp.t | 16 ++++++++++++++++ t/ssh.t | 16 ++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 t/scp.t create mode 100644 t/sftp.t create mode 100644 t/ssh.t diff --git a/t/scp.t b/t/scp.t new file mode 100644 index 00000000..1f810bb2 --- /dev/null +++ b/t/scp.t @@ -0,0 +1,16 @@ +use strict; +use warnings; + +use Test::More tests => 6; + +use URI (); +my $uri; + +$uri = URI->new("scp://user\@ssh.example.com/path"); + +is($uri->scheme, 'scp'); +is($uri->host, 'ssh.example.com'); +is($uri->port, 22); +is($uri->secure, 1); +is($uri->user, 'user'); +is($uri->password, undef); diff --git a/t/sftp.t b/t/sftp.t new file mode 100644 index 00000000..b3b37fc6 --- /dev/null +++ b/t/sftp.t @@ -0,0 +1,16 @@ +use strict; +use warnings; + +use Test::More tests => 6; + +use URI (); +my $uri; + +$uri = URI->new("sftp://user\@ssh.example.com/path"); + +is($uri->scheme, 'sftp'); +is($uri->host, 'ssh.example.com'); +is($uri->port, 22); +is($uri->secure, 1); +is($uri->user, 'user'); +is($uri->password, undef); diff --git a/t/ssh.t b/t/ssh.t new file mode 100644 index 00000000..49456ea9 --- /dev/null +++ b/t/ssh.t @@ -0,0 +1,16 @@ +use strict; +use warnings; + +use Test::More tests => 6; + +use URI (); +my $uri; + +$uri = URI->new("ssh://user\@ssh.example.com/path"); + +is($uri->scheme, 'ssh'); +is($uri->host, 'ssh.example.com'); +is($uri->port, 22); +is($uri->secure, 1); +is($uri->user, 'user'); +is($uri->password, undef);