I have been lately experiencing a kind of mess up when operating the Calibre 2.55 content server from a xUbuntu computer. The problem seems to have arisen when I upgraded my operation system fom xubuntu 14.04LTS to xUbuntu 16.04.LTS.
I privately share my library to several users on a theme based approach using multiple command line invocations :
calibre-server --daemonize --username 'name-of-user1' -- restriction 'first restriction' --password 'user—1-passwd' --port '1025'
calibre-server --daemonize --username 'name-of-user2' -- restriction 'second restriction' --password 'user—2-passwd' --port '1026'
Folowing the OS upgrade, after login on, all my guests received an "Error 500" warning mentioning cherrypy .
Looking at /home/my-username/.config/calibre/server_error_log I found those following batches of lines :
Code:
[13/Jun/2017:21:04:43] ENGINE Bus STARTING
[13/Jun/2017:21:04:43] ENGINE Started monitor thread '_TimeoutMonitor'.
[13/Jun/2017:21:04:44] ENGINE Serving on http://0.0.0.0:1025
[13/Jun/2017:21:04:46] ENGINE Bus STARTED
[13/Jun/2017:21:07:43] ENGINE Bus STARTING
[13/Jun/2017:21:07:43] ENGINE Started monitor thread '_TimeoutMonitor'.
[13/Jun/2017:21:07:43] ENGINE Serving on http://0.0.0.0:1025
[13/Jun/2017:21:07:46] ENGINE Bus STARTED
[13/Jun/2017:21:08:17] HTTP Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/cherrypy/_cprequest.py", line 670, in respond
response.body = self.handler()
File "/usr/lib/python2.7/dist-packages/cherrypy/lib/encoding.py", line 217, in __call__
self.body = self.oldhandler(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/cherrypy/_cpdispatch.py", line 61, in __call__
return self.callable(*self.args, **self.kwargs)
File "/usr/lib/calibre/calibre/library/server/utils.py", line 54, in do
ans = func(*args, **kwargs)
File "/usr/lib/calibre/calibre/library/server/utils.py", line 108, in authenticate
self.secret)
File "/usr/lib/python2.7/dist-packages/cherrypy/lib/auth_digest.py", line 364, in digest_auth
ha1 = get_ha1(realm, auth.username)
File "/usr/lib/python2.7/dist-packages/cherrypy/lib/auth_digest.py", line 57, in get_ha1
return md5_hex('%s:%s:%s' % (username, realm, password))
File "/usr/lib/python2.7/dist-packages/cherrypy/lib/auth_digest.py", line 30, in <lambda>
md5_hex = lambda s: md5(ntob(s)).hexdigest()
File "/usr/lib/python2.7/dist-packages/cherrypy/_cpcompat.py", line 68, in ntob
assert_native(n)
File "/usr/lib/python2.7/dist-packages/cherrypy/_cpcompat.py", line 111, in assert_native
raise TypeError("n must be a native str (got %s)" % type(n).__name__)
TypeError: n must be a native str (got unicode)
The workaround I found was to disable the password request so my guest readers could enjoy the library again, but there is some concern about unsolicited visitors… I can fortunately veil the logs to ban suspicious incomers using iptables, but I hope for a code improvement to be incorporated in a next release.