Skip to content

Commit ef0392a

Browse files
SineSwiperoalders
authored andcommitted
Add ftpes scheme, and encrypt_mode to ftp/ftps/ftpes
1 parent 67bc5db commit ef0392a

File tree

4 files changed

+40
-1
lines changed

4 files changed

+40
-1
lines changed

lib/URI/ftp.pm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ use parent qw(URI::_server URI::_userpass);
99

1010
sub default_port { 21 }
1111

12+
sub encrypt_mode { undef }
13+
1214
sub path { shift->path_query(@_) } # XXX
1315

1416
sub _user { shift->SUPER::user(@_); }

lib/URI/ftpes.pm

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package URI::ftpes;
2+
3+
require URI::ftp;
4+
@ISA=qw(URI::ftp);
5+
6+
sub secure { 1 }
7+
8+
sub encrypt_mode { 'explicit' }
9+
10+
1;

lib/URI/ftps.pm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ sub default_port { 990 }
77

88
sub secure { 1 }
99

10+
sub encrypt_mode { 'implicit' }
11+
1012
1;

t/ftp.t

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use strict;
22
use warnings;
33

4-
use Test::More tests => 13;
4+
use Test::More tests => 23;
55

66
use URI ();
77
my $uri;
@@ -14,6 +14,10 @@ is($uri->host, "ftp.example.com");
1414

1515
is($uri->port, 21);
1616

17+
is($uri->secure, 0);
18+
19+
is($uri->encrypt_mode, undef);
20+
1721
is($uri->user, "anonymous");
1822

1923
is($uri->password, 'anonymous@');
@@ -31,10 +35,31 @@ $uri->password("secret");
3135
is($uri, "ftp://gisle%40aas.no:secret\@ftp.example.com/path");
3236

3337
$uri = URI->new("ftp://gisle\@aas.no:secret\@ftp.example.com/path");
38+
3439
is($uri, "ftp://gisle\@aas.no:secret\@ftp.example.com/path");
3540

3641
is($uri->userinfo, "gisle\@aas.no:secret");
3742

3843
is($uri->user, "gisle\@aas.no");
3944

4045
is($uri->password, "secret");
46+
47+
$uri = URI->new("ftps://ftp.example.com/path");
48+
49+
is($uri->scheme, "ftps");
50+
51+
is($uri->port, 990);
52+
53+
is($uri->secure, 1);
54+
55+
is($uri->encrypt_mode, 'implicit');
56+
57+
$uri = URI->new("ftpes://ftp.example.com/path");
58+
59+
is($uri->scheme, "ftpes");
60+
61+
is($uri->port, 21);
62+
63+
is($uri->secure, 1);
64+
65+
is($uri->encrypt_mode, 'explicit');

0 commit comments

Comments
 (0)