Skip to content

Commit

Permalink
Item9037: {urlHost} is used by loadSession, so it needs to be set ear…
Browse files Browse the repository at this point in the history
…lier

git-svn-id: http://svn.foswiki.org/trunk@7465 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
SvenDowideit authored and SvenDowideit committed May 19, 2010
1 parent 32cb5b6 commit bfd6a33
Showing 1 changed file with 21 additions and 17 deletions.
38 changes: 21 additions & 17 deletions core/lib/Foswiki.pm
Expand Up @@ -1624,6 +1624,27 @@ sub new {

#Monitor::MARK("Created users object");

#{urlHost} is needed by loadSession..
my $url = $query->url();
if ( $url && $url =~ m{^([^:]*://[^/]*).*$} ) {
$this->{urlHost} = $1;

# If the urlHost in the url is localhost, this is a lot less
# useful than the default url host. This is because new CGI("")
# assigns this host by default - it's a default setting, used
# when there is nothing better available.
if ( $this->{urlHost} eq 'http://localhost' ) {
$this->{urlHost} = $Foswiki::cfg{DefaultUrlHost};
}
elsif ( $Foswiki::cfg{RemovePortNumber} ) {
$this->{urlHost} =~ s/\:[0-9]+$//;
}
}
else {
$this->{urlHost} = $Foswiki::cfg{DefaultUrlHost};
}
ASSERT($this->{urlHost}) if DEBUG;

# Load (or create) the CGI session
$this->{remoteUser} = $this->{users}->loadSession($defaultUser);

Expand All @@ -1642,24 +1663,7 @@ sub new {
}
delete @ENV{qw( IFS CDPATH ENV BASH_ENV )};

my $url = $query->url();
if ( $url && $url =~ m{^([^:]*://[^/]*).*$} ) {
$this->{urlHost} = $1;

# If the urlHost in the url is localhost, this is a lot less
# useful than the default url host. This is because new CGI("")
# assigns this host by default - it's a default setting, used
# when there is nothing better available.
if ( $this->{urlHost} eq 'http://localhost' ) {
$this->{urlHost} = $Foswiki::cfg{DefaultUrlHost};
}
elsif ( $Foswiki::cfg{RemovePortNumber} ) {
$this->{urlHost} =~ s/\:[0-9]+$//;
}
}
else {
$this->{urlHost} = $Foswiki::cfg{DefaultUrlHost};
}
if ( $Foswiki::cfg{GetScriptUrlFromCgi}
&& $url
&& $url =~ m{^[^:]*://[^/]*(.*)/.*$}
Expand Down

0 comments on commit bfd6a33

Please sign in to comment.