Add the --no-keepalive option to allow disabling of KeepAlive
This commit is contained in:
parent
ced3ab6f57
commit
16c12e85ef
|
@ -1,3 +1,4 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
# Copyright (c) 2008, Donovan Preston
|
# Copyright (c) 2008, Donovan Preston
|
||||||
#
|
#
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
# 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')
|
access_log_file = open(access_log_file, 'a')
|
||||||
|
|
||||||
server_event = coros.event()
|
server_event = coros.event()
|
||||||
|
http_version = config.get('no_keepalive') and 'HTTP/1.0' or 'HTTP/1.1'
|
||||||
try:
|
try:
|
||||||
wsgi.server(
|
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:
|
except KeyboardInterrupt:
|
||||||
pass
|
pass
|
||||||
except ExitChild:
|
except ExitChild:
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
# Copyright (c) 2008, Donovan Preston
|
# Copyright (c) 2008, Donovan Preston
|
||||||
#
|
#
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
# 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 '
|
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 '
|
'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.')
|
'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',
|
parser.add_option('-z', '--z-restart-args', dest='restart_args',
|
||||||
help='For internal use only')
|
help='For internal use only')
|
||||||
|
|
||||||
|
@ -513,6 +516,7 @@ def main():
|
||||||
'access_log_file': options.access_log_file,
|
'access_log_file': options.access_log_file,
|
||||||
'pidfile': options.pidfile,
|
'pidfile': options.pidfile,
|
||||||
'coverage': options.coverage,
|
'coverage': options.coverage,
|
||||||
|
'no_keepalive' : options.no_keepalive,
|
||||||
'argv_str': " ".join(sys.argv[1:]),
|
'argv_str': " ".join(sys.argv[1:]),
|
||||||
'args': positional_args,
|
'args': positional_args,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue