[New-bugs-announce] [issue7167] Smarter FTP passive mode

Antoine Pitrou report at bugs.python.org
Sun Oct 18 23:22:25 CEST 2009


New submission from Antoine Pitrou <pitrou at free.fr>:

I have come accross an FTP server which lftp (an Unix command-line
client) handles well but ftplib doesn't. Both ftplib and lftp are
configured to use passive mode (this server apparently doesn't handle
non-passive), but the address sent in response by the server is a
private IP. Here is a wireshark transcript of the FTP conversation done
by lftp:

220 172.29.AAA.BBB FTP server ready

FEAT

211-Features:
 LANG en
 MDTM
 UTF8
 AUTH TLS
 PBSZ
 PROT
 REST STREAM
 SIZE

211 End

LANG

200 Using default language en

OPTS UTF8 ON

200 UTF8 set to on

USER XXXX
331 Password required for ftth_rdvph

PASS XXXX
230 Connexion reussie pour ftth_rdvph

PWD

257 "/" is the current directory

PASV

227 Entering Passive Mode (172,29,AAA,BBB,195,84).

LIST

150 Opening ASCII mode data connection for file list

226 Transfer complete



As you see, lftp had no problem opening a data connection. It probably
notices that the address advertised in response to PASV doesn't respond
(after e.g. a 2s. timeout), and falls back on the host's known address
instead. In contrast, ftplib simply sits while the connection is
attempted and bails out at the end with a connection error.

----------
components: Library (Lib)
messages: 94226
nosy: giampaolo.rodola, pitrou
priority: normal
severity: normal
status: open
title: Smarter FTP passive mode
type: feature request
versions: Python 2.7, Python 3.2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7167>
_______________________________________


More information about the New-bugs-announce mailing list