classification
Title: ftplib Persistent data connection
Type: feature request
Components: Library (Lib) Versions: Python 2.6
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: giampaolo.rodola, gregory.p.smith, jbell
Priority: Keywords: patch

Created on 2008-04-13 23:50 by jbell, last changed 2008-05-12 21:47 by jbell.

Files
File name Uploaded Description Edit Remove
ftplib.py.blockmode.patch jbell, 2008-04-13 23:50 Patch to add block mode transmission
debug.log jbell, 2008-04-13 23:54 Expected debug output
ftplib.py.blockmode.patch.2 jbell, 2008-05-12 21:24 Patch (revised) to add block mode
ftplib.rst.blockmode.patch jbell, 2008-05-12 21:25 Documentation patch
Messages
msg65454 (view) Author: Jonathan (jbell) Date: 2008-04-13 23:50
About a year ago I found myself fighting a broken FTP server that
couldn't handle multiple passive data transfers through a firewall or
NATed connection. Thankfully, this same problem server supports block
transmission mode, which allows a client to create a single data
connection for transferring multiple files.

I've attached a patch (and sample debug output) for the latest trunk.

Might this be useful to anyone else in any way? I realize any MODE
option rather than S is widely unsupported and possibly an edge case,
but getting this into trunk would be preferable. We've been running this
code under Python2.3 for nearly a year -- the jobs run several times per
hour -- and are extremely happy with the results.
msg65455 (view) Author: Jonathan (jbell) Date: 2008-04-13 23:54
Here's the debug output when the transfers are going well.
msg66305 (view) Author: Gregory P. Smith (gregory.p.smith) Date: 2008-05-06 07:23
rather than using the array.array for your three byte header with manual
parsing, please use struct.unpack.

Whats a good way to test that this works?  It'd be nice to have a unit
test (a test_ftplib_net.py perhaps?) though I realize ftplib currently
has poor test coverage with no such explicit network test existing
beyond things the urllib tests might do.

also, could you make the appropriate documentation updates against
python trunk's Doc/lib/ftplib.rst.  Mention when & what servers you
found using this mode useful with if at all possible.
msg66762 (view) Author: Jonathan (jbell) Date: 2008-05-12 21:47
I've attached two new files. The first swaps the array.array usage for
struct.unpack. The second simply modifies the rst documentation.

I'm not sure how we'd do any tests for FTP without making use of an
actual server. In a quick check of servers, MadGoat (for OpenVMS) was
the only BLOCK-supporting server I found; neither vsftpd nor proftpd
support BLOCK. (I didn't check wuftpd.) Sadly, I've no publicly
accessible servers available to me for others to test against.
History
Date User Action Args
2008-05-12 21:47:35jbellsetmessages: + msg66762
2008-05-12 21:25:13jbellsetfiles: + ftplib.rst.blockmode.patch
2008-05-12 21:24:47jbellsetfiles: + ftplib.py.blockmode.patch.2
2008-05-06 07:23:26gregory.p.smithsetnosy: + gregory.p.smith
messages: + msg66305
2008-04-14 15:09:51giampaolo.rodolasetnosy: + giampaolo.rodola
2008-04-13 23:54:53jbellsetfiles: + debug.log
messages: + msg65455
2008-04-13 23:50:10jbellcreate