TLS_FTPHandler occurred error with pyOpenSSL==0.14
(It is not occurred with pyOpenSSL==0.13)
#### spam.py ###
from pyftpdlib.servers import FTPServer
from pyftpdlib.authorizers import DummyAuthorizer
from pyftpdlib.handlers import TLS_FTPHandler
def main():
authorizer = DummyAuthorizer()
authorizer.add_user('user', '12345', '.', perm='elradfmw')
authorizer.add_anonymous('.')
handler = TLS_FTPHandler
handler.certfile = 'server.pem'
handler.authorizer = authorizer
server = FTPServer(('', 10021), handler)
server.serve_forever()
if __name__ == '__main__':
main()
#####
$ python -V
Python 2.7.3
$ pip freeze
argparse==1.2.1
cffi==0.8.2
cryptography==0.2.2
pyOpenSSL==0.14
pycparser==2.10
pyftpdlib==1.3.0
six==1.6.1
wsgiref==0.1.2
$ python spam.py
[I 14-03-15 02:05:31] >>> starting FTP server on
0.0.0.0:10021, pid=8486 <<<
[I 14-03-15 02:05:31] poller: <class 'pyftpdlib.ioloop.Epoll'>
[I 14-03-15 02:05:31] masquerade (NAT) address: None
[I 14-03-15 02:05:31] passive ports: None
[I 14-03-15 02:05:31] use sendfile(2): False
[I 14-03-15 02:05:44] 172.16.204.1:57037-[] FTP session opened (connect)
[E 14-03-15 02:05:49] unhandled exception in instance <pyftpdlib.handlers.TLS_FTPHandler object at 0x1d39e50>
Traceback (most recent call last):
File "/usr/lib/python2.7/asyncore.py", line 83, in read
obj.handle_read_event()
File "/home/tokibito/.virtualenvs/pyftpdlib-error/local/lib/python2.7/site-packages/pyftpdlib/handlers.py", line 2997, in handle_read_event
super(SSLConnection, self).handle_read_event()
File "/usr/lib/python2.7/asyncore.py", line 444, in handle_read_event
self.handle_read()
File "/usr/lib/python2.7/asynchat.py", line 158, in handle_read
self.found_terminator()
File "/home/tokibito/.virtualenvs/pyftpdlib-error/local/lib/python2.7/site-packages/pyftpdlib/handlers.py", line 1322, in found_terminator
self.pre_process_command(line, cmd, arg)
File "/home/tokibito/.virtualenvs/pyftpdlib-error/local/lib/python2.7/site-packages/pyftpdlib/handlers.py", line 1371, in pre_process_command
self.process_command(cmd, arg)
File "/home/tokibito/.virtualenvs/pyftpdlib-error/local/lib/python2.7/site-packages/pyftpdlib/handlers.py", line 3268, in process_command
FTPHandler.process_command(self, cmd, *args, **kwargs)
File "/home/tokibito/.virtualenvs/pyftpdlib-error/local/lib/python2.7/site-packages/pyftpdlib/handlers.py", line 1439, in process_command
method(*args, **kwargs)
File "/home/tokibito/.virtualenvs/pyftpdlib-error/local/lib/python2.7/site-packages/pyftpdlib/handlers.py", line 2359, in ftp_USER
self.respond('331 Username ok, send password.')
File "/home/tokibito/.virtualenvs/pyftpdlib-error/local/lib/python2.7/site-packages/pyftpdlib/handlers.py", line 1627, in respond
self.push(resp + '\r\n')
File "/home/tokibito/.virtualenvs/pyftpdlib-error/local/lib/python2.7/site-packages/pyftpdlib/handlers.py", line 1622, in push
asynchat.async_chat.push(self, s.encode('utf8'))
File "/usr/lib/python2.7/asynchat.py", line 186, in push
self.initiate_send()
File "/home/tokibito/.virtualenvs/pyftpdlib-error/local/lib/python2.7/site-packages/pyftpdlib/ioloop.py", line 885, in initiate_send
asynchat.async_chat.initiate_send(self)
File "/usr/lib/python2.7/asynchat.py", line 235, in initiate_send
num_sent = self.send(data)
File "/home/tokibito/.virtualenvs/pyftpdlib-error/local/lib/python2.7/site-packages/pyftpdlib/handlers.py", line 3025, in send
return super(SSLConnection, self).send(data)
File "/home/tokibito/.virtualenvs/pyftpdlib-error/local/lib/python2.7/site-packages/pyftpdlib/ioloop.py", line 854, in send
return self.socket.send(data)
File "/home/tokibito/.virtualenvs/pyftpdlib-error/local/lib/python2.7/site-packages/OpenSSL/SSL.py", line 947, in send
raise TypeError("data must be a byte string")
TypeError: data must be a byte string
[I 14-03-15 02:05:49] 172.16.204.1:57037-[] FTP session closed (disconnect).