X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fupstream%2Fblosxom.git;a=blobdiff_plain;f=blosxom.cgi;h=997fcc74a4a00fdc80eb0cd82265e8c64f850643;hp=068b7183d1afb9f85010de247d56f428670346e7;hb=0f7240c4441b085dd9f46a326abe19e6b5a77ed5;hpb=364a736f0bce810faa7f809d4eb6cd74c2972d5b diff --git a/blosxom.cgi b/blosxom.cgi index 068b718..997fcc7 100755 --- a/blosxom.cgi +++ b/blosxom.cgi @@ -84,8 +84,17 @@ my $fh = new FileHandle; @num2month = sort { $month2num{$a} <=> $month2num{$b} } keys %month2num; # Use the stated preferred URL or figure it out automatically -$url ||= url(); -$url =~ s/^included:/http:/; # Fix for Server Side Includes (SSI) +$url ||= url(-path_info => 1); +$url =~ s/^included:/http:/ if $ENV{SERVER_PROTOCOL} eq 'INCLUDED'; + +# NOTE: Since v3.12, it looks as if CGI.pm misbehaves for SSIs and +# always appends path_info to the url. To fix this, we always +# request an url with path_info, and always remove it from the end of the +# string. +my $pi_len = length $ENV{PATH_INFO}; +my $might_be_pi = substr($url, -$pi_len); +substr($url, -length $ENV{PATH_INFO}) = '' if $might_be_pi eq $ENV{PATH_INFO}; + $url =~ s!/$!!; # Drop ending any / from dir settings