TLS pyftpd с пропускной способностью полосы пропускания вызывает ошибку
Я использую pyftpdlib для создания собственного FTP-сервера. Мне нужно поддерживать TLS, а также регулирование пропускной способности, оба из которых описаны в учебной документации. Однако, когда я пытаюсь использовать их вместе, я получаю сообщение об ошибке при попытке соединиться с FileZilla:
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
Мой код (в основном только что вставленный из учебника):
import os
from pyftpdlib.handlers import TLS_FTPHandler, ThrottledDTPHandler
from pyftpdlib.servers import FTPServer
from pyftpdlib.authorizers import DummyAuthorizer
def main():
authorizer = DummyAuthorizer()
authorizer.add_user('user', '12345', os.getcwd(), perm='elradfmw')
authorizer.add_anonymous(os.getcwd())
dtp_handler = ThrottledDTPHandler
dtp_handler.read_limit = 30720 # 30 Kb/sec (30 * 1024)
dtp_handler.write_limit = 30720 # 30 Kb/sec (30 * 1024)
ftp_handler = TLS_FTPHandler
ftp_handler.authorizer = authorizer
ftp_handler.certfile = "C:\\temp\\certificates\\test.pem"
# have the ftp handler use the alternative dtp handler class
ftp_handler.dtp_handler = dtp_handler
server = FTPServer(('', 2121), ftp_handler)
server.serve_forever()
if __name__ == '__main__':
main()
если я вычеркну строку:
ftp_handler.dtp_handler = dtp_handler
Я могу подключиться, но это, конечно, снимает троттлинг.
Есть ли способ заставить класс обработчика DTP работать с TLS?