create new tag
, view all tags
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

Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r2 - 2008-09-11 - TWikiJanitor
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.