Item5213: SCRIPTNAME not defined when using Sun One Web Server

pencil
Priority: Normal
Current State: Closed
Released In: 1.0.0
Target Release: patch
Applies To: Engine
Component:
Branches:
Reported By: TWiki:Main.PhilipSchmidt
Waiting For:
Last Change By: KennethLavrsen
I just installed version 4.1.2 to upgrade a 4.0.4 TWiki web site. Everything woked ok except for links within a page were incorrectly formated. The script name was not present in the link. I traced this back to the environment variable SCRIPT_FILENAME not being set by my web server.

The web server I have to run on is a Sun ONE Web Server/6.1 . The server does not seem to define SCRIPT_FILENAME or SCRIPT_URL. I modified TWiki.pm to display the environment variables that are defined and I found that the environment variable SCRIPT_NAME is defined.

The environment variable SCRIPT_NAME was defined with the contents "/~philip/twiki/bin/view.cg".

This problem does not exist in the 4.0 version of the TWiki software, but does exist for all versions of 4.1 and the 4.2 release candidate.

To fix the problem, I modifed the _SCRIPTNAME subroutine in TWiki.pm to add the following lines after the check for SCRIPT_FILENAME.
     $value = $ENV{SCRIPT_NAME};
    if( $value ) {
        $value =~ s!.*/([^/]+)$!$1!o;
        return $value;
    }

The variable SCRIPTNAME is now defined to be view.cgi and the base href in the web page is now correct.

The TWiki 4.2 version seems to work differently. It seems to want SCRIPTNAME to not contain the script suffix. To fix that version, I had to use the following code
     $value = $ENV{SCRIPT_NAME};
    if( $value ) {
        $value =~ s!.*/([^/]+)$!$1!o;
        if ( $TWiki::cfg{ScriptSuffix} ) {
          my $suffix = $TWiki::cfg{ScriptSuffix};
          $value =~ s|$suffix$|| if ($suffix);
        }
        return $value;If the script suffix was not removed, the software seemed to add an additional suffix.

The above problem in version 4.2 may be related to Item5176.

Other configuration information from the Web server is:
HTTP_USER_AGENT=Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.8.1.9) Gecko/20071030 SeaMonkey<a rel="nofollow" href="http://wwwin/%7Ephilip/twiki/bin/edit.cgi/Sandbox/SeaMonkey?topicparent=Sandbox.TocPage" title="Create this topic">?</a> /1.1.6
SERVER_SOFTWARE=Sun ONE Web Server/6.1
SERVER_PORT=80
HTTPS=OFF
GATEWAY_INTERFACE=CGI/1.1
SERVER_PROTOCOL=HTTP/1.1  
The previous bug report, Item3588, to fix a similar problem did not make any difference to my situation.

-- TWiki:Main/PhilipSchmidt - 06 Jan 2008

Although imprtant, this is not a release blocker for the 4.2.0 release. Per release meeting, reprioritized to normal.

-- TWiki:Main.PeterThoeny - 07 Jan 2008

The introduction of FoswikiStandAlone naturally closed this issue. Foswiki doesn't depend on non-RFC environment variables.

-- GilmarSantosJr - 14 Jan 2009

Setting to closed as this one is actually fixed in 1.0.0 but will just add it to the fixed list on the release note so that for 1.0.1 it is shown as fixed in 1.0.0. Just to inform the Sun One Web users of yet another good reason to upgrade to Foswiki.

-- KennethLavrsen - 14 Jan 2009

ItemTemplate edit

Summary SCRIPTNAME not defined when using Sun One Web Server
ReportedBy TWiki:Main.PhilipSchmidt
Codebase
SVN Range TWiki-4.1.1, Mon, 05 Feb 2007, build 12770 - TWiki-4.2.0-rc2, Mon, 10 Dec 2007, build 15958
AppliesTo Engine
Component
Priority Normal
CurrentState Closed
WaitingFor
Checkins distro:7ed983df147a
TargetRelease patch
ReleasedIn 1.0.0
Topic revision: r5 - 14 Jan 2009, KennethLavrsen
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy