]> 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 384b497d28154b8a98c48f67141f3c2339df71e7..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";
   }
@@ -184,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;' :
@@ -198,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});
   }
@@ -208,6 +212,7 @@ sub redirect_request
   return OK;
 }
 
+
 =item get_protocol
 
 =cut