aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/LXRng/Context.pm9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/LXRng/Context.pm b/lib/LXRng/Context.pm
index 6611b46..f4865f0 100644
--- a/lib/LXRng/Context.pm
+++ b/lib/LXRng/Context.pm
@@ -41,7 +41,7 @@ sub new {
my $path = $ENV{'REQUEST_URI'};
$path =~ s/\?.*//;
$path =~ s,/+,/,g;
- $$self{'req_url'} = $host.$path;
+ $$self{'req_base'} = $host.$ENV{'SCRIPT_NAME'};
foreach my $p ($args{'query'}->param) {
$$self{'params'}{$p} = [$args{'query'}->param($p)];
@@ -61,6 +61,11 @@ sub new {
last;
}
}
+ unless ($$self{'tree'}) {
+ if ($ENV{'PATH_INFO'} =~ m,^/?([^/]+)/?(.*),) {
+ @$self{'tree', 'path'} = ($1, $2);
+ }
+ }
$$self{'tree'} = $args{'query'}->param('tree')
if $args{'query'}->param('tree');
@@ -196,7 +201,7 @@ sub base_url {
my $base = $self->config->{'base_url'};
unless ($base) {
- $base = $$self{'req_url'};
+ $base = $$self{'req_base'};
}
$base =~ s,/*$,/,;