aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArne Georg Gleditsch <argggh@lxr.linpro.no>2008-02-08 01:17:53 +0100
committerArne Georg Gleditsch <argggh@lxr.linpro.no>2008-02-08 01:17:53 +0100
commit8b06651682da715d47e811441f73013033731c4b (patch)
tree9333911c390dbf7febefe10acb3b306afefbcbd0
parent8038cc1ba3d260ac1017d0ffe2105c29ed716b5f (diff)
Fidget around with the base url logic some more.
-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,/*$,/,;