]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
www_static: path_info_raw: support non-HTTP(S) schemes
authorEric Wong <e@80x24.org>
Fri, 14 Mar 2025 09:22:05 +0000 (09:22 +0000)
committerEric Wong <e@80x24.org>
Tue, 18 Mar 2025 07:04:48 +0000 (07:04 +0000)
We may add support for gemini:// which supports CGI-like
protocols like PSGI, so relaxing the HTTP(S) URL scheme
requirement seems to make sense.

lib/PublicInbox/WwwStatic.pm

index af4eb9601accbe93ed01c96c7e114b219e734b85..7136f3cdedeb550dd8eb76f555c12c9094696308 100644 (file)
@@ -220,7 +220,7 @@ sub path_info_raw ($) {
        my $re = $path_re_cache{$sn} //= do {
                $sn = '/'.$sn unless index($sn, '/') == 0;
                $sn =~ s!/\z!!;
-               qr!\A(?:https?://[^/]+)?\Q$sn\E(/[^\?\#]+)!;
+               qr!\A(?:[^:]+://[^/]+)?\Q$sn\E(/[^\?\#]+)!;
        };
        $env->{REQUEST_URI} =~ $re ? $1 : $env->{PATH_INFO};
 }