Change default timeout to 120 seconds and ensure Keep-Alive header uses integers

This commit is contained in:
Kovid Goyal 2015-05-27 10:50:52 +05:30
parent ec521d58c5
commit f22af669e8
2 changed files with 2 additions and 2 deletions

View File

@ -324,7 +324,7 @@ class HTTPConnection(HTTPRequest):
outheaders.set('Server', 'calibre %s' % __version__, replace_all=True) outheaders.set('Server', 'calibre %s' % __version__, replace_all=True)
keep_alive = not self.close_after_response and self.opts.timeout > 0 keep_alive = not self.close_after_response and self.opts.timeout > 0
if keep_alive: if keep_alive:
outheaders.set('Keep-Alive', 'timeout=%d' % self.opts.timeout) outheaders.set('Keep-Alive', 'timeout=%d' % int(self.opts.timeout))
if 'Connection' not in outheaders: if 'Connection' not in outheaders:
if self.response_protocol is HTTP11: if self.response_protocol is HTTP11:
if self.close_after_response: if self.close_after_response:

View File

@ -29,7 +29,7 @@ raw_options = (
None, None,
'Time (in seconds) after which an idle connection is closed', 'Time (in seconds) after which an idle connection is closed',
'timeout', 60.0, 'timeout', 120.0,
None, None,
'Total time in seconds to wait for clean shutdown', 'Total time in seconds to wait for clean shutdown',