From aceb21f07ae1fd9b8a7216ddc79fa4cc705f326b Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Fri, 19 Nov 2021 18:59:52 -0800 Subject: [PATCH] Add support for Protocols directive to enable http2 --- apache/core.pl | 29 ++++++++++++++++++++++++++++- apache/lang/en | 6 ++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/apache/core.pl b/apache/core.pl index c3bd8aca0..101589c00 100755 --- a/apache/core.pl +++ b/apache/core.pl @@ -5,6 +5,7 @@ # Returns ar array of references to associative arrays, each containing # information about some directive. The keys of each array are: # name - The name of this directive +# multiple - Can this directive appear multiple times # type - What kind of directive this in. Possible values are # 0 - Processes and limits # 1 - Networking and addresses @@ -27,7 +28,6 @@ # 18- Filters # 19- Character Sets # 20- Image maps -# multiple - Can this directive appear multiple times # global - Can be used in the global server context # virtual - Can be used in a VirtualHost section or in the global section # directory - Can be used in a Directory section context @@ -72,6 +72,7 @@ $rv = [ [ 'AccessFileName', 0, 5, 'virtual', undef, 5 ], [ 'NameVirtualHost', 1, 1, 'global', '1.3-2.4', 5 ], [ 'Options', 0, 5, 'virtual directory htaccess', undef, 3 ], [ 'PidFile', 0, 9, 'global', -2.0 ], + [ 'Protocols', 0, 1, 'virtual', 2.4 ], [ 'require', 0, 4, 'directory htaccess', undef, 6 ], [ 'RLimitCPU', 0, 0, 'virtual', 1.2 ], [ 'RLimitMEM', 0, 0, 'virtual', 1.2 ], @@ -615,6 +616,32 @@ if (@nv) { return ( \@nv ); } else { return ( [ ] ); } } +sub edit_Protocols +{ +my %p = map { $_, 1 } @{$_[0]->{'words'}}; +my @popts = ( "http/1.1", "h2", "h2c" ); +my @psel = map { &ui_checkbox("protocols", $_, $text{'core_protocols_'.$_} || $_, $p{$_}) } @popts; +return (1, + $text{'core_protocols'}, + &ui_radio("protocols_def", %p ? 0 : 1, + [ [ 1, $text{'default'}. + " (".$text{'core_protocols_http/1.1'}.")
" ], + [ 0, $text{'core_protocols_sel'} ] ])." ". + join(" ", @psel), + ); +} +sub save_Protocols +{ +if ($in{'protocols_def'}) { + return ( [ ] ); + } +else { + my @prots = split(/\0/, $in{'protocols'}); + @prots || &error($text{'core_eprotocols'}); + return ( [ join(" ", @prots) ] ); + } +} + ######################################################################### # Document directives sub edit_AccessFileName diff --git a/apache/lang/en b/apache/lang/en index 2d953120b..cc1473ed7 100644 --- a/apache/lang/en +++ b/apache/lang/en @@ -385,6 +385,12 @@ core_altnames=Alternate virtual server names core_hostname=Server hostname core_virtaddr=Addresses for name virtual servers core_virtaddr_star=Include all addresses +core_protocols=HTTP protocols to accept +core_protocols_sel=Selected protocols : +core_protocols_http/1.1=HTTP 1.1 +core_protocols_h2=HTTP2 encrypted +core_protocols_h2c=HTTP2 unencrypted +core_eprotcols=No protocols selected! core_ekeeptout=Keep-alive timeout must be an integer core_elqueue=Listen queue length must be an integer core_ebufsize=TCP send buffer size must be an integer