]> Sergey Matveev's repositories - public-inbox.git/commitdiff
http: coerce SERVER_PORT to integer
authorEric Wong <e@80x24.org>
Thu, 4 Aug 2022 08:16:57 +0000 (08:16 +0000)
committerEric Wong <e@80x24.org>
Thu, 4 Aug 2022 20:09:32 +0000 (20:09 +0000)
This may save a few bytes with many connected clients.
Noticed while working on the JMAP endpoint.

lib/PublicInbox/HTTP.pm

index 669211e38099fbacf3e4b4309deeced1568c5d00..3d4e34995dfbd9f11749c052ec7f6766331177f5 100644 (file)
@@ -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) {