Skip to content

Commit

Permalink
Item13331: Item12189: Fix older versions of CGI
Browse files Browse the repository at this point in the history
The CGI character set needs to be set in older CGI.

This also picks up a change to CGI temporary file locations
  • Loading branch information
gac410 committed Apr 20, 2015
1 parent 7f5796f commit f16eb6e
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions core/lib/Foswiki.pm
Expand Up @@ -1982,6 +1982,9 @@ sub new {
$ENV{TEMP} = $Foswiki::cfg{TempfileDir};
$ENV{TMP} = $Foswiki::cfg{TempfileDir};

# Make sure CGI is also using the appropriate tempfile location
$CGI::TMPDIRECTORY = $Foswiki::cfg{TempfileDir};

# Make %ENV safer, preventing hijack of the search path. The
# environment is set per-query, so this can't be done in a BEGIN.
# This MUST be done before any external programs are run via Sandbox.
Expand Down Expand Up @@ -2041,6 +2044,12 @@ sub new {
$initialContext->{admin_available} = 1; # True if sudo supported.
}

# Tell Foswiki::Response which charset we are using if not default
$Foswiki::cfg{Site}{CharSet} ||= 'iso-8859-1';

# Also tell CGI, Item13331 fix for older CGI releases
CGI::charset( $Foswiki::cfg{Site}{CharSet} );

$query ||= new Foswiki::Request();

# Phase 2 of Bootstrap. Web settings require that the Foswiki request
Expand All @@ -2067,9 +2076,6 @@ sub new {
. Data::Dumper->Dump( [ [caller], [ caller(1) ] ] );
}

# Tell Foswiki::Response which charset we are using if not default
$Foswiki::cfg{Site}{CharSet} ||= 'iso-8859-1';

$this->{request} = $query;
$this->{cgiQuery} = $query; # for backwards compatibility in contribs
$this->{response} = new Foswiki::Response();
Expand Down

0 comments on commit f16eb6e

Please sign in to comment.