Skip to content

Commit

Permalink
Item13023: Sync with core. Allow for undef PATH_INFO
Browse files Browse the repository at this point in the history
  • Loading branch information
gac410 committed Nov 6, 2014
1 parent ed271a1 commit f6dadc2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
12 changes: 9 additions & 3 deletions data/System/TestBootstrapPlugin.txt
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" date="1410575131" format="1.1" version="1"}%
%META:TOPICINFO{author="ProjectContributor" date="1415232596" format="1.1" version="1"}%
%META:TOPICPARENT{name="Plugins"}%
<!--
* Set SHORTDESCRIPTION = %$SHORTDESCRIPTION%
Expand All @@ -11,6 +11,8 @@

This plugin runs the new configuration Bootstrap code developed for Foswiki 1.2. It
generates a report describing the settings that this feature will generate.
It shows the difference between the current Foswiki configuration and the
bootstrapped version.

The Bootstrap code allows foswiki to run in a minimal configuration without
a =LocalSite.cfg= file. However it is very dependent upon the environment
Expand All @@ -25,8 +27,12 @@ This has been tested on 1.0.9, 1.1.9 and 1.2 alpha. It uses the real 1.2 boots
code on 1.2-alpha, and a local copy of the bootstrap code when running on
1.1.x.

Please send the following bootstrap report to the foswiki developers:
*This report is only available to administrators*
Please send the following bootstrap report to the foswiki developers.
*Caution:* This report might reveal sensitive host and client information
including hostnames, file system paths and IP addresses.
*This report is only available to administrators*. Please sanitize the
report and send it to foswiki-security@lists.sourceforge.net The Security
email list has a very limited distribution.

%BOOTSTRAP%

Expand Down
9 changes: 5 additions & 4 deletions lib/Foswiki/Plugins/TestBootstrapPlugin.pm
Expand Up @@ -227,11 +227,12 @@ sub _bootstrapConfig {
# and then recovers it. When the jsonrpc script is called to save the configuration
# it then has the VIEWPATH parameter available. If "view" was never called during
# configuration, then it will not be set correctly.
my $path_info = $ENV{PATH_INFO} || ''; # SMELL Sometimes PATH_INFO in undef
print STDERR "AUTOCONFIG: REQUEST_URI is $ENV{REQUEST_URI} \n" if (TRAUTO);
print STDERR "AUTOCONFIG: SCRIPT_URI is "
. ( $ENV{SCRIPT_URI} || '(undef)' ) . " \n"
if (TRAUTO);
print STDERR "AUTOCONFIG: PATH_INFO is $ENV{PATH_INFO} \n" if (TRAUTO);
print STDERR "AUTOCONFIG: PATH_INFO is $path_info \n" if (TRAUTO);
print STDERR "AUTOCONFIG: ENGINE is $Foswiki::cfg{Engine}\n"
if (TRAUTO);

Expand Down Expand Up @@ -265,9 +266,9 @@ sub _bootstrapConfig {
}
else {
my $suffix =
( length( $ENV{SCRIPT_URL} ) < length( $ENV{PATH_INFO} ) )
( length( $ENV{SCRIPT_URL} ) < length($path_info) )
? $ENV{SCRIPT_URL}
: $ENV{PATH_INFO};
: $path_info;

# Try to Determine the prefix of the script part of the URI.
if ( $ENV{SCRIPT_URI} && $ENV{SCRIPT_URL} ) {
Expand All @@ -285,7 +286,7 @@ sub _bootstrapConfig {
}

unless ( defined $pfx ) {
if ( my $idx = index( $ENV{REQUEST_URI}, $ENV{PATH_INFO} ) ) {
if ( my $idx = index( $ENV{REQUEST_URI}, $path_info ) ) {
$pfx = substr( $ENV{REQUEST_URI}, 0, $idx + 1 );
}
$pfx = '' unless ( defined $pfx );
Expand Down

0 comments on commit f6dadc2

Please sign in to comment.