From e28e9985f8b93ba5b0009f66be3b214f5fdea9b5 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 4 Aug 2022 08:16:57 +0000 Subject: [PATCH] http: coerce SERVER_PORT to integer This may save a few bytes with many connected clients. Noticed while working on the JMAP endpoint. --- lib/PublicInbox/HTTP.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/PublicInbox/HTTP.pm b/lib/PublicInbox/HTTP.pm index 669211e3..3d4e3499 100644 --- a/lib/PublicInbox/HTTP.pm +++ b/lib/PublicInbox/HTTP.pm @@ -135,7 +135,7 @@ sub app_dispatch { $env->{REMOTE_ADDR} = $self->{remote_addr}; $env->{REMOTE_PORT} = $self->{remote_port}; if (defined(my $host = $env->{HTTP_HOST})) { - $host =~ s/:([0-9]+)\z// and $env->{SERVER_PORT} = $1; + $host =~ s/:([0-9]+)\z// and $env->{SERVER_PORT} = $1 + 0; $env->{SERVER_NAME} = $host; } if (defined $input) { -- 2.44.0