CGIWrap is a gateway program that allows general users to use
CGI scripts and
HTML forms without compromising the security of the http server. Scripts are run with the permissions of the user who owns the script. In addition, several security checks are performed on the script, which will not be executed if any checks fail.
CGIWrap is often used by web hosting providers.
To get TWiki-4 to work with CGIWrap, make the following change in TWiki.pm.
In
sub new
, add the line in green:
my $pathInfo = $query->path_info();
my $cgiScriptName = $ENV{'SCRIPT_NAME'} || '';
$pathInfo =~ s!$cgiScriptName/!/!i;
$pathInfo =~ s!$TWiki::cfg{ScriptUrlPath}/[-a-zZ0-9]+$TWiki::cfg{ScriptSuffix}/!/!i;
# Get the web and topic names from PATH_INFO
if( $pathInfo =~ /\/((?:.*[\.\/])+)(.*)/ ) {
Add one of the following two lines to
LocalLib.cfg
, otherwise whenever a redirect is triggered through the exception mechanism, an information message is printed before the Content-Type, which the webserver does not like at all :-(.
open(STDERR, ">>/dev/null"); # throw away cgi script errors, or
open(STDERR, ">>/tmp/error.log"); # redirect errors to a log file
(Only one of the lines is needed; the first throws errors away, the second is an alternative that saves errors to a log file).
Contributors: MarcFurrer,
CrawfordCurrie
CategoryCookbook