]> git.decadent.org.uk Git - maypole.git/blobdiff - lib/Apache/MVC.pm
fix to Apache::MVC redirect_request
[maypole.git] / lib / Apache / MVC.pm
index 831527639e58336d5cb0afb8af647cbeaf1fb5eb..696ab84847a75987f1ce785728f1ae1eecce673c 100644 (file)
@@ -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