From c2d6ba54fa83887f947870c6fec4e23caf38254d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 22 Jun 2017 21:18:23 +0530 Subject: [PATCH] Server: Fix bug causing some things to not work when using SSL support on Linux of macOS sendfile() does nto work with SSL sockets because of SSL framing --- src/calibre/srv/http_response.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/calibre/srv/http_response.py b/src/calibre/srv/http_response.py index c048c3656f..dca4b25c02 100644 --- a/src/calibre/srv/http_response.py +++ b/src/calibre/srv/http_response.py @@ -546,7 +546,9 @@ class HTTPConnection(HTTPRequest): self.reset_state() return if isinstance(output, ReadableOutput): - self.use_sendfile = output.use_sendfile and self.opts.use_sendfile and sendfile_to_socket_async is not None + self.use_sendfile = output.use_sendfile and self.opts.use_sendfile and sendfile_to_socket_async is not None and self.ssl_context is None + # sendfile() does nto work with SSL sockets since encryption has to + # be done in userspace if output.ranges is not None: if isinstance(output.ranges, Range): r = output.ranges