This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author dwaites
Recipients dwaites
Date 2015-10-18.19:44:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
There is an issue with the python FTPS module in the standard library which appears to be related to SSL session reuse. I noticed when I updated to a recent version of Pure-FTPd (1.0.42), python's FTPS library client stopped working and generated an error in the ssl unwrap call when a data connection is opened after prot_p() is used. Checking the change log on that version of Pure-FTPd, there is this note:

- The ONLY_ACCEPT_REUSED_SSL_SESSIONS switch (introduced in Pure-FTPd
1.0.22 circa 2009, but disabled back then due to client compatibility
concerns) is now on by default, except in broken clients compatibility mode.

Turning on the broken clients compatibility mode in pure-ftpd makes the Python client work again, so I'm surmising this is related to pure-ftpd forcing SSL session reuse. My question is, is this something the Python standard library should detect, or is it a problem lower in the stack (i.e., libssl?) Incidentally, I can reproduce this behavior on Python 2.7 as well.

Steps to reproduce:

import ftplib
ftp = ftplib.FTP_TLS(ftphost, ftpuser, ftppass)
ftp.retrbinary('RETR ' + cmofile, infile.write)

Traceback (most recent call last): 
File "/home/dwaites/bin/", line 212, in 
File "/home/dwaites/bin/", line 155, in main 
site.retrbinary('RETR ' + cmofile, infile.write) 
File "/usr/lib/python3.4/", line 449, in retrbinary 
File "/usr/lib/python3.4/", line 788, in unwrap 
s = self._sslobj.shutdown() 
OSError: [Errno 0] Error
Date User Action Args
2015-10-18 19:44:18dwaitessetrecipients: + dwaites
2015-10-18 19:44:18dwaitessetmessageid: <>
2015-10-18 19:44:18dwaiteslinkissue25437 messages
2015-10-18 19:44:17dwaitescreate