X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=lib%2FApache%2FMVC.pm;h=696ab84847a75987f1ce785728f1ae1eecce673c;hb=8bee7ab27f76f2b3e8a65113ded4d439ec4949fe;hp=831527639e58336d5cb0afb8af647cbeaf1fb5eb;hpb=2c5d6782f89dc1532398b1b79c8f67b982c758ac;p=maypole.git diff --git a/lib/Apache/MVC.pm b/lib/Apache/MVC.pm index 8315276..696ab84 100644 --- a/lib/Apache/MVC.pm +++ b/lib/Apache/MVC.pm @@ -108,8 +108,9 @@ sub get_request { sub warn { my ($self,@args) = @_; my ($package, $line) = (caller)[0,2]; + my $ar = $self->parent ? $self->parent->{ar} : $self->{ar}; if ( $args[0] and ref $self ) { - $self->{ar}->warn("[$package line $line] ", @args) ; + $ar->warn("[$package line $line] ", @args) ; } else { print "warn called by ", caller, " with ", @_, "\n"; } @@ -134,7 +135,8 @@ sub parse_location { } my $path = $self->ar->uri; - my $loc = $self->ar->location; + my $base = URI->new($self->config->uri_base); + my $loc = $base->path; { no warnings 'uninitialized'; @@ -183,8 +185,7 @@ can only be combined with status. =cut -sub redirect_request -{ +sub redirect_request { my $r = shift; my $redirect_url = $_[0]; my $status = $MODPERL2 ? eval 'Apache2::Const::REDIRECT;' : @@ -197,7 +198,11 @@ sub redirect_request my $path = $args{path} || $r->path; my $host = $args{domain} || $r->ar->hostname; my $protocol = $args{protocol} || $r->get_protocol; - $redirect_url = "${protocol}://${host}/${path}"; + + $redirect_url = URI->new; + $redirect_url->scheme($protocol); + $redirect_url->host($host); + $redirect_url->path($path); } $status = $args{status} if ($args{status}); } @@ -207,6 +212,7 @@ sub redirect_request return OK; } + =item get_protocol =cut