From 8f4720a57d9c5746dcf53fa6c612350c744c2cd1 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 10 Jan 2020 09:14:16 +0000 Subject: allow HTTP_HOST to be '0' via defined() checks '0' is a valid value for HTTP_HOST, and maybe some folks will want to hit that as port 80 where the HTTP client won't send the ":$PORT" suffix. --- lib/PublicInbox/HTTP.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/PublicInbox/HTTP.pm') diff --git a/lib/PublicInbox/HTTP.pm b/lib/PublicInbox/HTTP.pm index a6ec1d0d..071251c6 100644 --- a/lib/PublicInbox/HTTP.pm +++ b/lib/PublicInbox/HTTP.pm @@ -155,7 +155,7 @@ sub app_dispatch { my $env = $self->{env}; $env->{REMOTE_ADDR} = $self->{remote_addr}; $env->{REMOTE_PORT} = $self->{remote_port}; - if (my $host = $env->{HTTP_HOST}) { + if (defined(my $host = $env->{HTTP_HOST})) { $host =~ s/:([0-9]+)\z// and $env->{SERVER_PORT} = $1; $env->{SERVER_NAME} = $host; } -- cgit v1.2.3-24-ge0c7