Skip to content

Commit

Permalink
Add support for Protocols directive to enable http2
Browse files Browse the repository at this point in the history
  • Loading branch information
jcameron committed Nov 20, 2021
1 parent 0e115cb commit aceb21f
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
29 changes: 28 additions & 1 deletion apache/core.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -72,6 +72,7 @@ sub core_directives
[ '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 ],
Expand Down Expand Up @@ -615,6 +616,32 @@ sub save_NameVirtualHost
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'}.")<br>" ],
[ 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
Expand Down
6 changes: 6 additions & 0 deletions apache/lang/en
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit aceb21f

Please sign in to comment.