Skip to content

Commit

Permalink
optimize: use 'http2 on for nginx>1.25.3.'
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuizhuhaomeng committed Dec 8, 2024
1 parent ced30a3 commit 0ccd106
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/Test/Nginx/Util.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1119,6 +1119,7 @@ _EOC_
}

my $listen_opts = '';
my $http2_directive = '';

$ServerConfigHttp3 = '';
if (use_http3($block)) {
Expand All @@ -1135,7 +1136,11 @@ _EOC_
}

} elsif (use_http2($block)) {
$listen_opts .= " http2";
if ($NginxVersion >= "1.019009") {
$http2_directive = "http2 on;";
} else {
$listen_opts .= " http2";
}
}

if ($ReusePort) {
Expand Down Expand Up @@ -1171,7 +1176,7 @@ http {
$http_config
server {
listen $ServerPort$listen_opts;
listen $ServerPort$listen_opts;$http2_directive
_EOC_

# when using http3, we both listen on tcp for http and udp for http3
Expand Down

0 comments on commit 0ccd106

Please sign in to comment.