Python 带带宽限制的pyftpd TLS导致错误
我正在使用pyftpdlib创建一个自定义FTP服务器。我需要支持TLS和带宽限制,教程文档中介绍了这两个方面。但是,当我尝试同时使用它们时,当我尝试连接FileZilla时,会出现一个错误:Python 带带宽限制的pyftpd TLS导致错误,python,ssl,ftp,filezilla,pyftpdlib,Python,Ssl,Ftp,Filezilla,Pyftpdlib,我正在使用pyftpdlib创建一个自定义FTP服务器。我需要支持TLS和带宽限制,教程文档中介绍了这两个方面。但是,当我尝试同时使用它们时,当我尝试连接FileZilla时,会出现一个错误: Status: Resolving address of localhost Status: Connecting to [::1]:2121... Status: Connection established, waiting for welcome message... Status: Initial
Status: Resolving address of localhost
Status: Connecting to [::1]:2121...
Status: Connection established, waiting for welcome message...
Status: Initializing TLS...
Status: Verifying certificate...
Status: TLS connection established.
Status: Logged in
Status: Retrieving directory listing...
Command: PWD
Response: 257 "/" is the current directory.
Command: TYPE I
Response: 200 Type set to: Binary.
Command: EPSV
Response: 229 Entering extended passive mode (|||9527|).
Command: MLSD
Response: 150 File status okay. About to open data connection.
**Error: GnuTLS error -15: An unexpected TLS packet was received.**
Error: Transfer connection interrupted: ECONNABORTED - Connection aborted
Response: 226 Transfer complete.
Error: Failed to retrieve directory listing
我的代码(大部分是从中粘贴的):
如果我拿出那条线:
ftp_handler.dtp_handler = dtp_handler
我可以连接,但这当然消除了节流
有没有办法让DTP处理程序类与TLS一起工作?从
pyftpdlib
邮件列表中的这个,看起来您需要一个混合了throttledtpHandler
和TLS\u DTPHandler
类的小类。它建议多重继承,而且我没有苏格兰威士忌。我不确定您的意思是什么“我没有苏格兰威士忌”,抱歉。该线程中的一封电子邮件建议创建一个类,使两个DTPHandler
最大化,如下所示:class MixedHandler(throttleddpHandler,TLS\u DTPHandler):
(例如,在main
方法之前),然后使用该类:dtp\u handler=MixedHandler
。这有帮助吗?
ftp_handler.dtp_handler = dtp_handler