Skip to content

Commit e22edfd

Browse files
committed
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.
1 parent 73b6a89 commit e22edfd

File tree

4 files changed

+38
-4
lines changed

4 files changed

+38
-4
lines changed

CHANGES.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ Features:
4848
responsive templates already have this feature.
4949
- issue2550917 - Add a: "Welcome user, you have logged in" ok_message
5050
on login. (Ashley Burke)
51+
- enable HTTP/1.1 for roundup-server. This enables keep-alive for
52+
faster response/loading. Also eliminates stalls when the front end web
53+
server uses http 1.1 but the roundup-server uses 1.0. New option
54+
"-V HTTP/1.0" can turn it off. (John Rouillard)
5155

5256
2021-07-13 2.1.0
5357

roundup/configuration.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,16 @@ def str2value(self, value):
639639
return value
640640

641641

642+
class HttpVersionOption(Option):
643+
"""Used by roundup-server to verify http version is set to valid
644+
string."""
645+
646+
def str2value(self, value):
647+
if value not in ["HTTP/1.0", "HTTP/1.1"]:
648+
raise OptionValueError(self, value, "Valid vaues for -V or --http_version are: HTTP/1.0, HTTP/1.1")
649+
return value
650+
651+
642652
class RegExpOption(Option):
643653

644654
"""Regular Expression option (value is Regular Expression Object)"""

roundup/scripts/roundup_server.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -635,9 +635,12 @@ class ServerConfig(configuration.Config):
635635
(configuration.WordListOption, "include_headers", "",
636636
"Comma separated list of extra headers that should\n"
637637
"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"
639639
"X-Proxy-User headers in the back end,\n"
640640
"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+
641644
)),
642645
("trackers", (), "Roundup trackers to serve.\n"
643646
"Each option in this section defines single Roundup tracker.\n"
@@ -663,6 +666,7 @@ class ServerConfig(configuration.Config):
663666
"ssl": "s",
664667
"pem": "e:",
665668
"include_headers": "I:",
669+
"http_version": 'V:',
666670
}
667671

668672
def __init__(self, config_file=None):
@@ -732,6 +736,8 @@ def setup(self):
732736
# internal state correctly so that later closing SSL
733737
# socket works (with SSL end-handshake started)
734738
self.request.do_handshake()
739+
RoundupRequestHandler.protocol_version = \
740+
self.CONFIG["HTTP_VERSION"]
735741
RoundupRequestHandler.setup(self)
736742

737743
def finish(self):
@@ -864,8 +870,8 @@ def usage(message=''):
864870
to the file indicated by PIDfile. The -l option *must* be
865871
specified if -d is used.'''
866872
if message:
867-
message += '\n'
868-
print(_('''%(message)sUsage: roundup-server [options] [name=tracker home]*
873+
message += '\n\n'
874+
print(_('''\n%(message)sUsage: roundup-server [options] [name=tracker home]*
869875
870876
Options:
871877
-v print the Roundup version number and exit
@@ -886,6 +892,9 @@ def usage(message=''):
886892
-e <fname> PEM file containing SSL key and certificate
887893
-t <mode> multiprocess mode (default: %(mp_def)s).
888894
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+
889898
%(os_part)s
890899
891900
Long options:

share/man/man1/roundup-server.1

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,15 @@ Sets a filename to use as a template for generating the tracker index page.
3535
The variable "trackers" is available to the template and is a dict of all
3636
configured trackers.
3737
.TP
38+
\fB-I\fP \fIheader1[,header2,...]\fP
39+
Pass the header(s) and their values to the backend. This allow-list
40+
of header variables can be used by custom code in the tracker or with
41+
a tracker's \fBhttp_auth_header\fP configuration option to allows a
42+
front end server to authenticate a user and pass the user identity to
43+
roundup.
44+
.TP
3845
\fB-s\fP
39-
Enables to use of SSL.
46+
Enables use of SSL.
4047
.TP
4148
\fB-e\fP \fIfile\fP
4249
Sets a filename containing the PEM file to use for SSL. If left blank, a
@@ -45,6 +52,10 @@ temporary self-signed certificate will be used.
4552
\fB-N\fP
4653
Log client machine names instead of IP addresses (much slower).
4754
.TP
55+
\fB-V\fP \fIHTTPVER\fP
56+
By default roundup-server uses HTTP/1.1 to enable keepalives for faster
57+
response. HTTPVER can be set to \fBHTTP/1.0\fP to disable keepalives.
58+
.TP
4859
\fB-u\fP \fIUID\fP
4960
Runs the Roundup web server as this UID.
5061
.TP

0 commit comments

Comments
 (0)