comparison roundup/scripts/roundup_server.py @ 6514:a036712c96f4

Enable HTTP/1.1 support for roundup-server This enables keepalives and seems to prevent a lot of hangs/slowness in my configuration. configuration.py: add new HttpVersionOption. This is used by the command line/config in roundup-server. Validates http version string. roundup-server.py: enable HTTP 1.1 by default. use -V to set HTTP/1.0 on command line or set http_version in config file. Fix typo in config description for option include_headers. Add more vertical spacing for error report and usage display. roundup-server.1: add doc on -V also doc -I which was missing. Remove uneeded "to" from a sentence on ssl.
author John Rouillard <rouilj@ieee.org>
date Mon, 18 Oct 2021 20:12:09 -0400
parents 7fb13dc67a41
children 6cf050b43eaf
comparison
equal deleted inserted replaced
6513:1d6c986b3f72 6514:a036712c96f4
633 "PEM file used for SSL. A temporary self-signed certificate\n" 633 "PEM file used for SSL. A temporary self-signed certificate\n"
634 "will be used if left blank."), 634 "will be used if left blank."),
635 (configuration.WordListOption, "include_headers", "", 635 (configuration.WordListOption, "include_headers", "",
636 "Comma separated list of extra headers that should\n" 636 "Comma separated list of extra headers that should\n"
637 "be copied into the CGI environment.\n" 637 "be copied into the CGI environment.\n"
638 "E.G. if you want to acces the REMOTE_USER and\n" 638 "E.G. if you want to access the REMOTE_USER and\n"
639 "X-Proxy-User headers in the back end,\n" 639 "X-Proxy-User headers in the back end,\n"
640 "set to the value REMOTE_USER,X-Proxy-User."), 640 "set to the value REMOTE_USER,X-Proxy-User."),
641 (configuration.HttpVersionOption, "http_version", "HTTP/1.1",
642 "Change to HTTP/1.0 if needed. This disables keepalive."),
643
641 )), 644 )),
642 ("trackers", (), "Roundup trackers to serve.\n" 645 ("trackers", (), "Roundup trackers to serve.\n"
643 "Each option in this section defines single Roundup tracker.\n" 646 "Each option in this section defines single Roundup tracker.\n"
644 "Option name identifies the tracker and will appear in the URL.\n" 647 "Option name identifies the tracker and will appear in the URL.\n"
645 "Option value is tracker home directory path.\n" 648 "Option value is tracker home directory path.\n"
661 "template": "i:", 664 "template": "i:",
662 "loghttpvialogger": 'L', 665 "loghttpvialogger": 'L',
663 "ssl": "s", 666 "ssl": "s",
664 "pem": "e:", 667 "pem": "e:",
665 "include_headers": "I:", 668 "include_headers": "I:",
669 "http_version": 'V:',
666 } 670 }
667 671
668 def __init__(self, config_file=None): 672 def __init__(self, config_file=None):
669 configuration.Config.__init__(self, config_file, self.SETTINGS) 673 configuration.Config.__init__(self, config_file, self.SETTINGS)
670 self.sections.append("trackers") 674 self.sections.append("trackers")
730 if self.CONFIG["SSL"]: 734 if self.CONFIG["SSL"]:
731 # perform initial ssl handshake. This will set 735 # perform initial ssl handshake. This will set
732 # internal state correctly so that later closing SSL 736 # internal state correctly so that later closing SSL
733 # socket works (with SSL end-handshake started) 737 # socket works (with SSL end-handshake started)
734 self.request.do_handshake() 738 self.request.do_handshake()
739 RoundupRequestHandler.protocol_version = \
740 self.CONFIG["HTTP_VERSION"]
735 RoundupRequestHandler.setup(self) 741 RoundupRequestHandler.setup(self)
736 742
737 def finish(self): 743 def finish(self):
738 RoundupRequestHandler.finish(self) 744 RoundupRequestHandler.finish(self)
739 if self.CONFIG["SSL"]: 745 if self.CONFIG["SSL"]:
862 -g <GID> runs the Roundup web server as this GID 868 -g <GID> runs the Roundup web server as this GID
863 -d <PIDfile> run the server in the background and write the server's PID 869 -d <PIDfile> run the server in the background and write the server's PID
864 to the file indicated by PIDfile. The -l option *must* be 870 to the file indicated by PIDfile. The -l option *must* be
865 specified if -d is used.''' 871 specified if -d is used.'''
866 if message: 872 if message:
867 message += '\n' 873 message += '\n\n'
868 print(_('''%(message)sUsage: roundup-server [options] [name=tracker home]* 874 print(_('''\n%(message)sUsage: roundup-server [options] [name=tracker home]*
869 875
870 Options: 876 Options:
871 -v print the Roundup version number and exit 877 -v print the Roundup version number and exit
872 -h print this text and exit 878 -h print this text and exit
873 -S create or update configuration file and exit 879 -S create or update configuration file and exit
884 -s enable SSL 890 -s enable SSL
885 -L http request logging uses python logging (roundup.http) 891 -L http request logging uses python logging (roundup.http)
886 -e <fname> PEM file containing SSL key and certificate 892 -e <fname> PEM file containing SSL key and certificate
887 -t <mode> multiprocess mode (default: %(mp_def)s). 893 -t <mode> multiprocess mode (default: %(mp_def)s).
888 Allowed values: %(mp_types)s. 894 Allowed values: %(mp_types)s.
895 -V <version> set HTTP version (default: HTTP/1.1).
896 Allowed values: HTTP/1.0, HTTP/1.1.
897
889 %(os_part)s 898 %(os_part)s
890 899
891 Long options: 900 Long options:
892 --version print the Roundup version number and exit 901 --version print the Roundup version number and exit
893 --help print this text and exit 902 --help print this text and exit

Roundup Issue Tracker: http://roundup-tracker.org/