]> Sergey Matveev's repositories - public-inbox.git/commitdiff
http: require SERVER_PORT to be ASCII digit
authorEric Wong <e@80x24.org>
Tue, 4 Jun 2019 02:04:26 +0000 (02:04 +0000)
committerEric Wong <e@80x24.org>
Tue, 4 Jun 2019 10:06:18 +0000 (10:06 +0000)
I'm not sure what middlewares care for for SERVER_PORT; but
allowing non-ASCII digits seems non-sensical, here.

lib/PublicInbox/HTTP.pm

index 10e6d6a43b518115c7eece8a5f11e67ebe613fb2..977614b489d80143c75ebe366513194e5d4977cb 100644 (file)
@@ -142,7 +142,7 @@ sub app_dispatch {
        $env->{REMOTE_ADDR} = $self->{remote_addr};
        $env->{REMOTE_PORT} = $self->{remote_port};
        if (my $host = $env->{HTTP_HOST}) {
-               $host =~ s/:(\d+)\z// and $env->{SERVER_PORT} = $1;
+               $host =~ s/:([0-9]+)\z// and $env->{SERVER_PORT} = $1;
                $env->{SERVER_NAME} = $host;
        }
        if (defined $input) {