Send Keep-Alive header

This commit is contained in:
Kovid Goyal 2015-05-23 08:07:11 +05:30
parent 886323b52f
commit ea36277c99
2 changed files with 5 additions and 2 deletions

View File

@ -578,6 +578,9 @@ class HTTPPair(object):
self.sent_headers = True
self.outheaders.set('Date', http_date(), replace_all=True)
self.outheaders.set('Server', 'calibre %s' % __version__, replace_all=True)
keep_alive = not self.close_connection and self.server_loop.opts.timeout > 0
if keep_alive:
self.outheaders.set('Keep-Alive', 'timeout=%d' % self.server_loop.opts.timeout)
if 'Connection' not in self.outheaders:
if self.response_protocol is HTTP11:
if self.close_connection:

View File

@ -32,8 +32,8 @@ raw_options = (
'request_queue_size', 5,
None,
'Timeout in seconds for accepted connections',
'timeout', 10.0,
'Time (in seconds) after which an idle connection is closed',
'timeout', 60.0,
None,
'Total time in seconds to wait for clean shutdown',