classification
Title: FTP_TLS in ftplib not supporting prot_p storlines in FTP7.5
Type: behavior Stage:
Components: Library (Lib) Versions: Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Jeremy.Brock, Nathan Cox, giampaolo.rodola, lszyba1, required field
Priority: normal Keywords:

Created on 2012-10-24 23:09 by Jeremy.Brock, last changed 2015-03-13 16:49 by Nathan Cox.

Files
File name Uploaded Description Edit
FTP7.5 Issues Documentation.zip Jeremy.Brock, 2012-10-24 23:09 Documentation of Python Code, Logs and IIS Logs
FTP7.5 Issues Documentation - PASV.zip Jeremy.Brock, 2012-10-25 21:12
Messages (5)
msg173719 - (view) Author: Jeremy Brock (Jeremy.Brock) Date: 2012-10-24 23:09
Recently I have been working on a project to utilize the new FTP_TLS library from ftplib in Python 2.7.3.  What I found is that no matter what I try, when prot_p() is called prior to transferring files to 2008 Server R2 running FTP7.5, the python client connection no longer is able to transfer files to the FTP7.5 server resulting in *get* '425 Data channel timed out due to not meeting the minimum bandwidth requirement.\r\n' .

    I have reproduced this in Python 2.7.3 on HPUX and Windows.

    I am able to successfully transfer files using winscp and Filezilla to the same FTP7.5 server using FTPes with Prot_P in Active Mode.
msg173750 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2012-10-25 09:44
Have you tried to see what happens in passive mode (use: ftps.set_pasv(True))?
msg173800 - (view) Author: Jeremy Brock (Jeremy.Brock) Date: 2012-10-25 21:12
Hello Giampaolo,

It is the same timeout in PASV with Prot_P, please see attached documentation.  Something I did not mention before is that the file being written shows up on the server but I can't view it because it is being used by another process. When the timeout occurs the file disappears - see attached images.

~Jeremy
msg235045 - (view) Author: Lukasz Szybalski (lszyba1) Date: 2015-01-30 17:45
Hello,
We are having issues usign ftplib for implicit TLS over port 990

I'm referencing a solution that states 

"For the implicit FTP TLS/SSL(defualt port 990), our client program must build a TLS/SSL connection right after the socket is created. But python's class FTP_TLS doesn't reload the connect function from class FTP. We need to fix it:"



http://stackoverflow.com/questions/12164470/python-ftp-tls-connection-issue

{{{
#ImplicityTLS.py
from ftplib import FTP_TLS
import socket
import ssl

class tyFTP(FTP_TLS):
    def __init__(self, host='', user='', passwd='', acct='', keyfile=None, certfile=None, timeout=60):
        FTP_TLS.__init__(self, host, user, passwd, acct, keyfile, certfile, timeout)
    def connect(self, host='', port=0, timeout=-999):
        if host != '':
            self.host = host
        if port > 0:
            self.port = port
        if timeout != -999:
            self.timeout = timeout

        try: 
            self.sock = socket.create_connection((self.host, self.port), self.timeout)
            self.af = self.sock.family
            self.sock = ssl.wrap_socket(self.sock, self.keyfile, self.certfile, ssl_version=ssl.PROTOCOL_TLSv1)
            self.file = self.sock.makefile('rb')
            self.welcome = self.getresp()
        except Exception as e:
            print e
        return self.welcome
}}}


Then from my main application I did this:

{{{
from ImplicityTLS import tyFTP
server = tyFTP()
server.connect(host="xxxxx", port=990)
server.login(user="yyyy", passwd="fffff")
server.prot_p()
}}}
msg238039 - (view) Author: Nathan Cox (Nathan Cox) Date: 2015-03-13 16:49
I have this issue intermittently with a server that I connect to, but the issue (at least for me) seems to be the minBytesPerSecond configuration triggering a remote disconnect of the connection.
History
Date User Action Args
2015-03-13 16:49:36Nathan Coxsetnosy: + Nathan Cox
messages: + msg238039
2015-03-09 18:18:09required fieldsetnosy: + required field
2015-01-30 17:45:36lszyba1setnosy: + lszyba1
messages: + msg235045
2012-10-25 21:12:20Jeremy.Brocksetfiles: + FTP7.5 Issues Documentation - PASV.zip

messages: + msg173800
2012-10-25 09:44:07giampaolo.rodolasetmessages: + msg173750
2012-10-25 01:12:04ned.deilysetnosy: + giampaolo.rodola
2012-10-24 23:09:24Jeremy.Brockcreate