Re: type=<typecode>, last for today I think
Gisle Aas (gisle@activestate.com)
15 Mar 2001 16:17:23 -0800
Bill_Melvin/SUNY%SUNY@esc.edu writes:
> Is there any way URI could [re]acquire the params() method and
> Protocol::ftp check for "type=a"? ;>
I think this patch should fix the problem.
Regards,
Gisle
Index: lib/LWP/Protocol/ftp.pm
===================================================================
RCS file: /cvsroot/libwww-perl/lwp5/lib/LWP/Protocol/ftp.pm,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -p -u -r1.27 -r1.28
--- lib/LWP/Protocol/ftp.pm 1999/11/04 20:25:51 1.27
+++ lib/LWP/Protocol/ftp.pm 2001/03/16 00:14:47 1.28
@@ -1,5 +1,5 @@
#
-# $Id: ftp.pm,v 1.27 1999/11/04 20:25:51 gisle Exp $
+# $Id: ftp.pm,v 1.28 2001/03/16 00:14:47 gisle Exp $
# Implementation of the ftp protocol (RFC 959). We let the Net::FTP
# package do all the dirty work.
@@ -116,12 +116,20 @@ sub request
my $remote_file = pop(@path);
$remote_file = '' unless defined $remote_file;
-# my $params = $url->params;
-# if (defined($params) && $params eq 'type=a') {
-# $ftp->ascii;
-# } else {
+ my $type;
+ if (ref $remote_file) {
+ my @params;
+ ($remote_file, @params) = @$remote_file;
+ for (@params) {
+ $type = $_ if s/^type=//;
+ }
+ }
+
+ if ($type && $type eq 'a') {
+ $ftp->ascii;
+ } else {
$ftp->binary;
-# }
+ }
for (@path) {
LWP::Debug::debug("CWD $_");