summaryrefslogtreecommitdiff
path: root/lib/URI/ftp.pm
diff options
context:
space:
mode:
authorAndreas Brachold <vdr07@deltab.de>2007-08-13 18:41:27 +0000
committerAndreas Brachold <vdr07@deltab.de>2007-08-13 18:41:27 +0000
commitbcbf441e09fb502cf64924ff2530fa144bdf52c5 (patch)
treef377707a2dac078db8cd0c7d7abfe69ac1006d71 /lib/URI/ftp.pm
downloadxxv-bcbf441e09fb502cf64924ff2530fa144bdf52c5.tar.gz
xxv-bcbf441e09fb502cf64924ff2530fa144bdf52c5.tar.bz2
* Move files to trunk
Diffstat (limited to 'lib/URI/ftp.pm')
-rw-r--r--lib/URI/ftp.pm45
1 files changed, 45 insertions, 0 deletions
diff --git a/lib/URI/ftp.pm b/lib/URI/ftp.pm
new file mode 100644
index 0000000..89aeb07
--- /dev/null
+++ b/lib/URI/ftp.pm
@@ -0,0 +1,45 @@
+package URI::ftp;
+
+require URI::_server;
+require URI::_userpass;
+@ISA=qw(URI::_server URI::_userpass);
+
+use strict;
+
+sub default_port { 21 }
+
+sub path { shift->path_query(@_) } # XXX
+
+sub _user { shift->SUPER::user(@_); }
+sub _password { shift->SUPER::password(@_); }
+
+sub user
+{
+ my $self = shift;
+ my $user = $self->_user(@_);
+ $user = "anonymous" unless defined $user;
+ $user;
+}
+
+sub password
+{
+ my $self = shift;
+ my $pass = $self->_password(@_);
+ unless (defined $pass) {
+ my $user = $self->user;
+ if ($user eq 'anonymous' || $user eq 'ftp') {
+ # anonymous ftp login password
+ # If there is no ftp anonymous password specified
+ # then we'll just use 'anonymous@'
+ # We don't try to send the read e-mail address because:
+ # - We want to remain anonymous
+ # - We want to stop SPAM
+ # - We don't want to let ftp sites to discriminate by the user,
+ # host, country or ftp client being used.
+ $pass = 'anonymous@';
+ }
+ }
+ $pass;
+}
+
+1;