projects
/
matthijs
/
upstream
/
blosxom.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
364a736
)
fix problem with CGI.pm and SSIs where url() doesn't work as documented
author
Kevin Scaldeferri
<kscaldef@users.sourceforge.net>
Mon, 10 Jul 2006 20:27:33 +0000
(20:27 +0000)
committer
Kevin Scaldeferri
<kscaldef@users.sourceforge.net>
Mon, 10 Jul 2006 20:27:33 +0000
(20:27 +0000)
blosxom.cgi
patch
|
blob
|
history
diff --git
a/blosxom.cgi
b/blosxom.cgi
index 068b7183d1afb9f85010de247d56f428670346e7..997fcc74a4a00fdc80eb0cd82265e8c64f850643 100755
(executable)
--- 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
@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
$url =~ s!/$!!;
# Drop ending any / from dir settings