我一直想知道为什么我的FTP over TLS与Windows 7 Pro 64 Bit上的Total Commander在一个不可理解的时间后中断。 几个小时后,我发现有可能使用perl脚本重现错误,您可以在下面看到。 如果Win防火墙打开,它会在“Durchgang 30”上打破,请参阅下面的输出。如果防火墙关闭它运行并运行并运行并运行.... 主动FTP模式没有变化。
为什么防火墙总是在同一点断裂? 有什么建议我要解决这个错误或任何跟踪划分原因?
非常感谢!
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
use v5.10;
my $debug = defined;
my $use_tls = defined;
print "INC:\n".join("\n",@INC);
print "\n\n";
print "Version Net::Cmd: ".$Net::Cmd::VERSION."\n";
print "Version Net::FTP::File: ".$Net::FTP::File::VERSION."\n";
print "Version Net::FTP: ".$Net::FTP::VERSION."\n";
print "Version IO::Socket::SSL: ".$IO::Socket::SSL::VERSION."\n";
print "Version IO::Socket::IP: ".$IO::Socket::IP::VERSION."\n";
print "Version IO::Handle: ".$IO::Handle::VERSION."\n";
print "Version Net::SSLeay: ".$Net::SSLeay::VERSION."\n";
use IO::Socket::SSL 2.012 qw(SSL_VERIFY_CLIENT_ONCE);
if (defined $debug) {$IO::Socket::SSL::DEBUG = 3}
use Net::FTP 3.05;
use Net::FTP::File;
my $ftp = Net::FTP->new(
'*****',
Debug => (defined $debug ? 1 : 0),
Timeout => 15,
SSL_ca_file => 'test_ftp_zertifikat.pem',
) or die 'Fehler '.$@.' in '.__LINE__;
if (defined $use_tls ) {
$ftp->starttls() or die "Fehler in ".__LINE__." wegen '$@'";
}
$ftp->login('*****','*****') or die 'Fehler in '.__LINE__;
if (!$ftp->isdir('/tmp')) {
$ftp->mkdir('/tmp',1) or die 'Fehler in '.__LINE__;
$ftp->site('CHMOD 0755 tmp') or die 'Fehler in '.__LINE__;
}
$ftp->cwd('/tmp') or die 'Fehler in '.__LINE__;
my $hash_ref = $ftp->dir();
say "dir Ergebnis:\n".Dumper($hash_ref);
$ftp->binary or die 'Fehler in '.__LINE__;
for (my $z = 1; $z <= 40; $z ++) {
say "\n\n\nDurchlauf $z:";
if ($ftp->isfile('testdatei.png')) {
$ftp->delete('testdatei.png') or die 'Fehler in '.__LINE__;
}
if (!$ftp->isfile('testdatei.png')) {
$ftp->put('test_ftp_datei.png','testdatei.png') or die 'Fehler in '.__LINE__;
$ftp->site('CHMOD 0755 testdatei.png') or die 'Fehler in '.__LINE__;
$hash_ref = $ftp->dir();
say "dir Ergebnis:\n".Dumper($hash_ref);
$ftp->get('testdatei.png','test_ftp_datei.png') or die 'Fehler in '.__LINE__;
say "dir Ergebnis:\n".Dumper($hash_ref);
}
else { say "Datei löschen fehlgeschlagen!"; }
}
INC:
C:/strawberry/perl/site/lib
C:/strawberry/perl/vendor/lib
C:/strawberry/perl/lib
.
Version Net::Cmd: 3.05
Version Net::FTP::File: 0.06
Version Net::FTP: 3.05
Version IO::Socket::SSL: 2.012
Version IO::Socket::IP: 0.37
Version IO::Handle: 1.34
Version Net::SSLeay: 1.68
...
...
...
...
...
...
Durchlauf 29:
Net::FTP=GLOB(0x30ca20)>>> SIZE testdatei.png
Net::FTP=GLOB(0x30ca20)<<< 213 0
Net::FTP=GLOB(0x30ca20)>>> PWD
Net::FTP=GLOB(0x30ca20)<<< 257 "/tmp" is the current directory
Net::FTP=GLOB(0x30ca20)>>> CWD testdatei.png
Net::FTP=GLOB(0x30ca20)<<< 550 testdatei.png: No such file or directory
Net::FTP=GLOB(0x30ca20)>>> CWD /tmp
Net::FTP=GLOB(0x30ca20)<<< 250 CWD command successful
Net::FTP=GLOB(0x30ca20)>>> PWD
Net::FTP=GLOB(0x30ca20)<<< 257 "/tmp" is the current directory
Net::FTP=GLOB(0x30ca20)>>> DELE testdatei.png
Net::FTP=GLOB(0x30ca20)<<< 250 DELE command successful
Net::FTP=GLOB(0x30ca20)>>> SIZE testdatei.png
Net::FTP=GLOB(0x30ca20)<<< 550 testdatei.png: No such file or directory
Net::FTP=GLOB(0x30ca20)>>> PWD
Net::FTP=GLOB(0x30ca20)<<< 257 "/tmp" is the current directory
Net::FTP=GLOB(0x30ca20)>>> CWD testdatei.png
Net::FTP=GLOB(0x30ca20)<<< 550 testdatei.png: No such file or directory
Net::FTP=GLOB(0x30ca20)>>> CWD /tmp
Net::FTP=GLOB(0x30ca20)<<< 250 CWD command successful
Net::FTP=GLOB(0x30ca20)>>> PWD
Net::FTP=GLOB(0x30ca20)<<< 257 "/tmp" is the current directory
Net::FTP=GLOB(0x30ca20)>>> PASV
Net::FTP=GLOB(0x30ca20)<<< 227 Entering Passive Mode (***,***,***,***,***,***).
Net::FTP=GLOB(0x30ca20)>>> STOR testdatei.png
DEBUG: .../IO/Socket/SSL.pm:542: socket not yet connected
DEBUG: .../IO/Socket/SSL.pm:544: socket connected
DEBUG: .../IO/Socket/SSL.pm:566: ssl handshake not started
DEBUG: .../IO/Socket/SSL.pm:599: using SNI with hostname *****
DEBUG: .../IO/Socket/SSL.pm:634: request OCSP stapling
DEBUG: .../IO/Socket/SSL.pm:653: set socket to non-blocking to enforce timeout=15
DEBUG: .../IO/Socket/SSL.pm:667: Net::SSLeay::connect -> -1
DEBUG: .../IO/Socket/SSL.pm:677: ssl handshake in progress
DEBUG: .../IO/Socket/SSL.pm:687: waiting for fd to become ready: SSL wants a read first
DEBUG: .../IO/Socket/SSL.pm:707: socket ready, retrying connect
DEBUG: .../IO/Socket/SSL.pm:2505: did not get stapled OCSP response
DEBUG: .../IO/Socket/SSL.pm:667: Net::SSLeay::connect -> 1
DEBUG: .../IO/Socket/SSL.pm:722: ssl handshake done
Net::FTP=GLOB(0x30ca20)<<< 150 Opening BINARY mode data connection for testdatei.png
Net::FTP=GLOB(0x30ca20)<<< 226 Transfer complete
Net::FTP=GLOB(0x30ca20)>>> SITE CHMOD 0755 testdatei.png
Net::FTP=GLOB(0x30ca20)<<< 200 SITE CHMOD command successful
Net::FTP=GLOB(0x30ca20)>>> PASV
Net::FTP=GLOB(0x30ca20)<<< 227 Entering Passive Mode (***,***,***,***,***,***).
Net::FTP=GLOB(0x30ca20)>>> LIST
DEBUG: .../IO/Socket/SSL.pm:542: socket not yet connected
DEBUG: .../IO/Socket/SSL.pm:544: socket connected
DEBUG: .../IO/Socket/SSL.pm:566: ssl handshake not started
DEBUG: .../IO/Socket/SSL.pm:599: using SNI with hostname *****
DEBUG: .../IO/Socket/SSL.pm:634: request OCSP stapling
DEBUG: .../IO/Socket/SSL.pm:653: set socket to non-blocking to enforce timeout=15
DEBUG: .../IO/Socket/SSL.pm:667: Net::SSLeay::connect -> -1
DEBUG: .../IO/Socket/SSL.pm:677: ssl handshake in progress
DEBUG: .../IO/Socket/SSL.pm:687: waiting for fd to become ready: SSL wants a read first
DEBUG: .../IO/Socket/SSL.pm:707: socket ready, retrying connect
DEBUG: .../IO/Socket/SSL.pm:2505: did not get stapled OCSP response
DEBUG: .../IO/Socket/SSL.pm:667: Net::SSLeay::connect -> 1
DEBUG: .../IO/Socket/SSL.pm:722: ssl handshake done
Net::FTP=GLOB(0x30ca20)<<< 150 Opening BINARY mode data connection for file list
Net::FTP=GLOB(0x30ca20)<<< 226 Transfer complete
dir Ergebnis:
$VAR1 = [
'-rwxr-xr-x 1 ***** *** 0 Apr 21 06:50 testdatei.png'
];
Net::FTP=GLOB(0x30ca20)>>> PASV
Net::FTP=GLOB(0x30ca20)<<< 227 Entering Passive Mode (***,***,***,***,***,***).
Net::FTP=GLOB(0x30ca20)>>> RETR testdatei.png
DEBUG: .../IO/Socket/SSL.pm:542: socket not yet connected
DEBUG: .../IO/Socket/SSL.pm:544: socket connected
DEBUG: .../IO/Socket/SSL.pm:566: ssl handshake not started
DEBUG: .../IO/Socket/SSL.pm:599: using SNI with hostname *****
DEBUG: .../IO/Socket/SSL.pm:634: request OCSP stapling
DEBUG: .../IO/Socket/SSL.pm:653: set socket to non-blocking to enforce timeout=15
DEBUG: .../IO/Socket/SSL.pm:667: Net::SSLeay::connect -> -1
DEBUG: .../IO/Socket/SSL.pm:677: ssl handshake in progress
DEBUG: .../IO/Socket/SSL.pm:687: waiting for fd to become ready: SSL wants a read first
DEBUG: .../IO/Socket/SSL.pm:707: socket ready, retrying connect
DEBUG: .../IO/Socket/SSL.pm:2505: did not get stapled OCSP response
DEBUG: .../IO/Socket/SSL.pm:667: Net::SSLeay::connect -> 1
DEBUG: .../IO/Socket/SSL.pm:722: ssl handshake done
Net::FTP=GLOB(0x30ca20)<<< 150 Opening BINARY mode data connection for testdatei.png
Net::FTP=GLOB(0x30ca20)<<< 226 Transfer complete
dir Ergebnis:
$VAR1 = [
'-rwxr-xr-x 1 ***** *** 0 Apr 21 06:50 testdatei.png'
];
...
...
...
Durchlauf 30:
Net::FTP=GLOB(0x30ca20)>>> SIZE testdatei.png
Net::FTP=GLOB(0x30ca20)<<< 213 0
Net::FTP=GLOB(0x30ca20)>>> PWD
Net::FTP=GLOB(0x30ca20)<<< 257 "/tmp" is the current directory
Net::FTP=GLOB(0x30ca20)>>> CWD testdatei.png
Net::FTP=GLOB(0x30ca20)<<< 550 testdatei.png: No such file or directory
Net::FTP=GLOB(0x30ca20)>>> CWD /tmp
Net::FTP=GLOB(0x30ca20)<<< 250 CWD command successful
Net::FTP=GLOB(0x30ca20)>>> PWD
Net::FTP=GLOB(0x30ca20)<<< 257 "/tmp" is the current directory
Net::FTP=GLOB(0x30ca20)>>> DELE testdatei.png
Net::FTP=GLOB(0x30ca20)<<< 250 DELE command successful
Net::FTP=GLOB(0x30ca20)>>> SIZE testdatei.png
Net::FTP=GLOB(0x30ca20)<<< 550 testdatei.png: No such file or directory
Net::FTP=GLOB(0x30ca20)>>> PWD
Net::FTP=GLOB(0x30ca20)<<< 257 "/tmp" is the current directory
Net::FTP=GLOB(0x30ca20)>>> CWD testdatei.png
Net::FTP=GLOB(0x30ca20)<<< 550 testdatei.png: No such file or directory
Net::FTP=GLOB(0x30ca20)>>> CWD /tmp
Net::FTP=GLOB(0x30ca20)<<< 250 CWD command successful
Net::FTP=GLOB(0x30ca20)>>> PWD
Net::FTP=GLOB(0x30ca20)<<< 257 "/tmp" is the current directory
Net::FTP=GLOB(0x30ca20)>>> PASV
Net::FTP=GLOB(0x30ca20)<<< 227 Entering Passive Mode (***,***,***,***,***,***).
Net::FTP=GLOB(0x30ca20)>>> STOR testdatei.pngDEBUG: .../IO/Socket/SSL.pm:542: socket not yet connected
DEBUG: .../IO/Socket/SSL.pm:544: socket connected
DEBUG: .../IO/Socket/SSL.pm:566: ssl handshake not started
DEBUG: .../IO/Socket/SSL.pm:599: using SNI with hostname *****
DEBUG: .../IO/Socket/SSL.pm:634: request OCSP stapling
DEBUG: .../IO/Socket/SSL.pm:653: set socket to non-blocking to enforce timeout=15
DEBUG: .../IO/Socket/SSL.pm:667: Net::SSLeay::connect -> -1
DEBUG: .../IO/Socket/SSL.pm:677: ssl handshake in progress
DEBUG: .../IO/Socket/SSL.pm:687: waiting for fd to become ready: SSL wants a read first
DEBUG: .../IO/Socket/SSL.pm:707: socket ready, retrying connect
DEBUG: .../IO/Socket/SSL.pm:2505: did not get stapled OCSP response
DEBUG: .../IO/Socket/SSL.pm:667: Net::SSLeay::connect -> 1
DEBUG: .../IO/Socket/SSL.pm:722: ssl handshake done
Net::FTP=GLOB(0x30ca20)<<< 150 Opening BINARY mode data connection for testdatei.png
Net::FTP=GLOB(0x30ca20)<<< 226 Transfer complete
Net::FTP=GLOB(0x30ca20)>>> SITE CHMOD 0755 testdatei.png
Net::FTP=GLOB(0x30ca20)<<< 200 SITE CHMOD command successful
Net::FTP=GLOB(0x30ca20)>>> PASV
Net::FTP=GLOB(0x30ca20)<<< 227 Entering Passive Mode (***,***,***,***,***,***).
Net::FTP=GLOB(0x30ca20)>>> LIST
DEBUG: .../IO/Socket/SSL.pm:542: socket not yet connected
DEBUG: .../IO/Socket/SSL.pm:544: socket connected
DEBUG: .../IO/Socket/SSL.pm:566: ssl handshake not started
DEBUG: .../IO/Socket/SSL.pm:599: using SNI with hostname *****
DEBUG: .../IO/Socket/SSL.pm:634: request OCSP stapling
DEBUG: .../IO/Socket/SSL.pm:653: set socket to non-blocking to enforce timeout=15
DEBUG: .../IO/Socket/SSL.pm:667: Net::SSLeay::connect -> -1
DEBUG: .../IO/Socket/SSL.pm:677: ssl handshake in progress
DEBUG: .../IO/Socket/SSL.pm:687: waiting for fd to become ready: SSL wants a read first
DEBUG: .../IO/Socket/SSL.pm:707: socket ready, retrying connect
DEBUG: .../IO/Socket/SSL.pm:2505: did not get stapled OCSP response
DEBUG: .../IO/Socket/SSL.pm:667: Net::SSLeay::connect -> 1
DEBUG: .../IO/Socket/SSL.pm:722: ssl handshake done
Net::FTP=GLOB(0x30ca20)<<< 150 Opening BINARY mode data connection for file list
DEBUG: .../IO/Socket/SSL.pm:1796: SSL read error
Net::FTP: Net::Cmd::getline(): unexpected EOF on command channel: Bad file descriptor at C:/strawberry/perl/lib/Net/FTP/dataconn.pm line 82.
dir Ergebnis:
$VAR1 = [
'-rwxr-xr-x 1 ***** *** 0 Apr 21 06:50 testdatei.png'
];
Net::FTP: Net::Cmd::_is_closed(): unexpected EOF on command channel: Bad file descriptor at script.pl line 53.
Net::FTP: Net::Cmd::_is_closed(): unexpected EOF on command channel: Bad file descriptor at script.pl line 53.
Fehler in 53 at script.pl line 53.
DEBUG: .../IO/Socket/SSL.pm:2635: free ctx 36702656 open=36702656
DEBUG: .../IO/Socket/SSL.pm:2640: free ctx 36702656 callback
DEBUG: .../IO/Socket/SSL.pm:2647: OK free ctx 36702656