Add the --no-keepalive option to allow disabling of KeepAlive

This commit is contained in:
R. Tyler Ballance 2010-01-12 22:57:42 -08:00
parent ced3ab6f57
commit 16c12e85ef
2 changed files with 8 additions and 1 deletions

View File

@ -1,3 +1,4 @@
#!/usr/bin/env python
# Copyright (c) 2008, Donovan Preston
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
@ -131,9 +132,11 @@ def serve_from_child(sock, config):
access_log_file = open(access_log_file, 'a')
server_event = coros.event()
http_version = config.get('no_keepalive') and 'HTTP/1.0' or 'HTTP/1.1'
try:
wsgi.server(
sock, wsgi_application, log=access_log_file, server_event=server_event)
sock, wsgi_application, log=access_log_file, server_event=server_event,
max_http_version=http_version)
except KeyboardInterrupt:
pass
except ExitChild:

View File

@ -1,3 +1,4 @@
#!/usr/bin/env python
# Copyright (c) 2008, Donovan Preston
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
@ -396,6 +397,8 @@ def main():
help='If given, the maximum amount of time (in seconds) an instance of spawning_child '
'is allowed to run. Once this time limit has expired a SIGHUP will be sent to '
'spawning_controller, causing it to restart all of the child processes.')
parser.add_option('--no-keepalive', dest='no_keepalive', action='store_true',
help='Disable HTTP/1.1 KeepAlive')
parser.add_option('-z', '--z-restart-args', dest='restart_args',
help='For internal use only')
@ -513,6 +516,7 @@ def main():
'access_log_file': options.access_log_file,
'pidfile': options.pidfile,
'coverage': options.coverage,
'no_keepalive' : options.no_keepalive,
'argv_str': " ".join(sys.argv[1:]),
'args': positional_args,
}