SHA256
1
0
forked from pool/perl
OBS User unknown 2006-12-20 21:05:07 +00:00 committed by Git OBS Bridge
parent 6ce6a17dad
commit faf5aebcf0
3 changed files with 83 additions and 2 deletions

View File

@ -0,0 +1,66 @@
This patch avoids several silly warnings, and fills $res->status_line with something useful
in case your FTP server babbles some text message without a leading response code.
Seen from ftp.opensuse.org:
connect(3, {sa_family=AF_INET, sin_port=htons(21), sin_addr=inet_addr("195.135.221.134")}, 16) = 0
read(3, "This server is busy, please try again later or any of my mirrors: http://download.opensuse.org\n\n", 1024) = 96
Note the missing "500 " before "This".
Command line ftp clients handle this gracefully, so should we.
With this patch, LWP clients see a status_line of "500 This server is busy, ..."
2006-12-20, jw@suse.de
--- perl-5.8.8/lib/Net/FTP.pm.orig 2006-12-20 21:09:01.075906000 +0100
+++ perl-5.8.8/lib/Net/FTP.pm 2006-12-20 21:09:17.324643000 +0100
@@ -119,7 +119,7 @@
unless ($ftp->response() == CMD_OK)
{
$ftp->close();
- $@ = $ftp->message;
+ $@ = $ftp->message || $@; # keep @$ if no message. Happens, when response did not start with a code.
undef $ftp;
}
@@ -1107,7 +1107,7 @@
sub response
{
my $ftp = shift;
- my $code = $ftp->SUPER::response();
+ my $code = $ftp->SUPER::response() || 5; # assume 500 if undef
delete ${*$ftp}{'net_ftp_pasv'}
if ($code != CMD_MORE && $code != CMD_INFO);
@@ -1122,9 +1122,11 @@
my $ftp = shift;
+
# Darn MS FTP server is a load of CRAP !!!!
+ # Expect to see undef here.
return ()
- unless ${*$ftp}{'net_cmd_code'} + 0;
+ unless 0 + (${*$ftp}{'net_cmd_code'}||0);
(${*$ftp}{'net_cmd_code'},1);
}
--- perl-5.8.8/lib/Net/Cmd.pm.orig 2006-12-20 21:09:05.850129000 +0100
+++ perl-5.8.8/lib/Net/Cmd.pm 2006-12-20 21:09:17.332631000 +0100
@@ -338,9 +338,11 @@
if ($cmd->debug);
($code,$more) = $cmd->parse_response($str);
+
unless(defined $code)
{
$cmd->ungetline($str);
+ $@ = $str; # $@ is used as a tunneling hack.
last;
}
@@ -351,6 +353,7 @@
last unless($more);
}
+ return undef unless defined $code;
substr($code,0,1);
}

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Wed Dec 20 21:17:03 CET 2006 - jw@suse.de
- graceful-net-ftp patch added.
Lousy FTP server responses could trigger silly error messages in Net::FTP
and had no usable status_line in LWP.
Now it is 500 + whatever message the server responded.
-------------------------------------------------------------------
Fri Feb 17 15:27:39 CET 2006 - mls@suse.de

View File

@ -13,7 +13,7 @@
Name: perl
BuildRequires: db-devel
License: GPL, Artistic License
License: Artistic License, GNU General Public License (GPL)
Group: Development/Languages/Perl
Provides: perl-500 perl-base perl-Digest perl-Digest-MD5 perl-Filter-Simple perl-I18N-LangTags perl-MIME-Base64 perl-Storable perl-Test-Simple perl-Text-Balanced perl-Time-HiRes perl-libnet
Obsoletes: perl-Digest perl-Digest-MD5 perl-Filter-Simple perl-I18N-LangTags perl-MIME-Base64 perl-Storable perl-Test-Simple perl-Text-Balanced perl-Time-HiRes perl-libnet
@ -21,10 +21,11 @@ Requires: gzip
PreReq: %fillup_prereq
Autoreqprov: on
Version: 5.8.8
Release: 4
Release: 34
Summary: The Perl interpreter
Source: perl-%{version}.tar.bz2
Patch: perl-%{version}.dif
Patch1: perl-gracefull-net-ftp.diff
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
@ -48,6 +49,7 @@ Authors:
%prep
%setup -q -n perl-5.8.8
%patch
%patch1 -p1
%build
options="-Doptimize='$RPM_OPT_FLAGS -Wall -pipe'"
@ -118,6 +120,11 @@ touch $cpa/perllocal.pod
%ghost %doc /usr/share/man/man3/perllocal.3pm.gz
%changelog -n perl
* Wed Dec 20 2006 - jw@suse.de
- graceful-net-ftp patch added.
Lousy FTP server responses could trigger silly error messages in Net::FTP
and had no usable status_line in LWP.
Now it is 500 + whatever message the server responded.
* Fri Feb 17 2006 - mls@suse.de
- suppress prototype warning in autouse [#151459]
* Wed Feb 01 2006 - mls@suse.de