Bug: Incorrect Web Name When Using Script Suffix
When using a scriptSuffix, for example .cgi, on the cgi-bin scripts, the $webName
variable is incorrectly set. The TWiki website proceeds to display an oops page for every topic.
Test case
Change the scripts files so they end in .cgi (ie view.cgi), edit the TWiki.cfg and set :
$scriptSuffix = ".cgi";
Attempt to load a page using
http://something/cgi-bin/view.cgi
Environment
| TWiki version: |
01 Dec 2001 |
| TWiki plugins: |
|
| Server OS: |
Linux 2.2.16 |
| Web server: |
|
| Perl version: |
5.005_03 |
| Client OS: |
Linux |
| Web Browser: |
Netscape 4.77 |
--
BillFarrow - 15 Feb 2002
I tracked it down to TWiki.pm (Line 187) in the regex for determining the $webName from $thePathInfo. Here is my fix.
if( $thePathInfo =~ /\.cgi\/(.*)\/(.*)$/ ) {
# is "bin/script/Webname/SomeTopic" or "bin/script/Webname/"
$webName = $1 || "" if( ! $webName );
$topicName = $2 || "" if( ! $topicName );
} elsif( $thePathInfo =~ /\.cgi\/(.*)/ ) {
# is "bin/script/Webname" or "bin/script/"
$webName = $1 || "" if( ! $webName );
}
Moved from NewBugTemplate by RichardDonkin - please do not edit that page, it changes the bug template for other users.
The proposed fix is not usable since it contains a hard coded
.cgi which breaks installations that do not have this suffix.
This code has been working correctly, is there maybe another issue? E.g. does the web server provide a non standard path info?
--
PeterThoeny - 16 Feb 2002
This may be the case, I am running it on a web hosting site with vritual domains. It is also installed in a user public_html directory, not off the server root. I have tried debugging this and I can do it again and report the paths if that would help. This solution was a last resort just to get it going. (I am sorry about editing the
NewBugTemplate, I am new to this)
--
BillFarrow - 26 Feb 2002
I've coded a fix for this over at
CobaltRaqInstall - it should work for any server environment, though it currently depends on $wikiHomeUrl pointing to .../bin/view. If it works for people, there should be a new TWiki.cfg variable created that can optionally be set to $cgibinpath if the web server has a broken path_info (as here).
You may be running under cgiwrap, which can cause this problem - see your web hoster's docs, and also run testenv and search for 'cgiwrap' there.
--
RichardDonkin - 26 Feb 2002
I've attached a much simpler patch to
CobaltRaqInstall, which is now committed to CVS for the
TWikiAlphaRelease. I would like to get some wider testing for this, as I suspect there are more extreme cases of PATH_INFO mangling that may need additional work.
The bug over at
CobaltRaqInstall is very similar, and I'm fairly confident this patch will fix the bug here as well, so I'm marking this
BugResolved.
--
RichardDonkin - 19 Mar 2002