Item8946: configure does not handle an empty ScriptUrlPath '' well

Priority: CurrentState: AppliesTo: Component: WaitingFor:
Normal Closed Engine Configure  
My preffered setup is such that the ScriptUrlPath is empty ''. I do this by making the /bin directory the DocumentRoot. This creates a Foswiki server with shorter URLs, eg:
http://my.foswiki.server/view/Main

The configure script doesn't like this, it expects the ScriptUrlPath to contain at least something. When trying to guess the setting it checks the ENV for REQUEST_URI or SCRIPT_NAME and then strips off the '/configure.*' off the end and uses the remainder as it's guessed value. In my case the remainder is the empty string '', which is correct. But it thinks it's wrong because the string is empty.

I'd like to propose this change, I believe it's not going to break anything else, but I'd like to get some feedback before checking in this change.

Index: lib/Foswiki/Configure/Checkers/ScriptUrlPath.pm
===================================================================
--- lib/Foswiki/Configure/Checkers/ScriptUrlPath.pm   (revision 7243)
+++ lib/Foswiki/Configure/Checkers/ScriptUrlPath.pm   (working copy)
@@ -10,15 +10,12 @@
     my $this = shift;
 
     # Check Script URL Path against REQUEST_URI
-    my $n;
     my $val    = $Foswiki::cfg{ScriptUrlPath};
     my $report = '';
-
     my $guess = $ENV{REQUEST_URI} || $ENV{SCRIPT_NAME} || '';
-    $guess =~ s(/+configure\b.*$)();
 
     if ( defined $val && $val ne 'NOT SET' ) {
-        if ($guess) {
+        if ($guess =~ s'/+configure\b.*$'') {
             if ( $guess !~ /^$val/ ) {
                 $report .= $this->WARN(
                     'I expected this to look like "' . $guess . '"' );
@@ -26,7 +23,7 @@
         }
         else {
             $report .= $this->WARN(<<HERE);
-This web server does not set REQUEST_URI or SCRIPT_NAME
+This web server does not correctly set REQUEST_URI or SCRIPT_NAME
 so it isn't possible to fully check the correctness of this setting.
 HERE
         }
@@ -37,12 +34,12 @@
         }
     }
     else {
-        if ($guess) {
+        if ($guess =~ s'/+configure\b.*$'') {
             $report .= $this->guessed(0);
         }
         else {
             $report .= $this->WARN(<<HERE);
-This web server does not set REQUEST_URI or SCRIPT_NAME
+This web server does not correctly set REQUEST_URI or SCRIPT_NAME
 so it isn't possible to guess this setting.
 HERE
             $guess = '';

PS. The file core/lib/Foswiki/Configure/Checkers/DispScriptUrlPath.pm is not used anywhere! Can I remove it?

-- VernonLyon - 23 Apr 2010

I've not received any feedback, so I've checked in this change. Although, I haven't removed the file core/lib/Foswiki/Configure/Checkers/DispScriptUrlPath.pm yet.

-- VernonLyon - 21 Jun 2010

Changing to waiting for release. I've made one fix under another Item - guessing /pub if results are totally empty.

-- GeorgeClark - 01 Aug 2010
 

ItemTemplate edit

Summary configure does not handle an empty ScriptUrlPath '' well
ReportedBy VernonLyon
Codebase trunk
SVN Range
AppliesTo Engine
Component Configure
Priority Normal
CurrentState Closed
WaitingFor
Checkins Foswikirev:7870
TargetRelease minor
ReleasedIn 1.1.0
Topic revision: r8 - 04 Oct 2010, KennethLavrsen
 
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. see CopyrightStatement. Creative Commons License