X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=lib%2FApache%2FMVC.pm;h=4d32dc43f6d260048ae47e5e41eb719728c8d9ac;hb=dd369c8a18080c4f27237f23b5842d53da05f570;hp=0f6b7d0e9fc8c0dda03506ff398da25900b17cf0;hpb=ef9ebe8ef9785b0fec3e3b20e70212e701f1c397;p=maypole.git diff --git a/lib/Apache/MVC.pm b/lib/Apache/MVC.pm index 0f6b7d0..4d32dc4 100644 --- a/lib/Apache/MVC.pm +++ b/lib/Apache/MVC.pm @@ -93,7 +93,11 @@ functionality. See L for these: sub get_request { my ($self, $r) = @_; - my $ar = ($MODPERL2) ? $r : Apache::Request->instance($r); + my $ar; + if ($MODPERL2) { + $ar = eval {require Apache2::Request} ? Apache2::Request->new($r) : $r; + } + else { $ar = Apache::Request->instance($r); } $self->ar($ar); } @@ -138,8 +142,7 @@ sub parse_args { =cut -sub redirect_request -{ +sub redirect_request { my $r = shift; my $redirect_url = $_[0]; my $status = $MODPERL2 ? eval 'Apache2::Const::REDIRECT;' : @@ -152,7 +155,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}); } @@ -224,7 +231,7 @@ sub _mod_perl_args { } else { my $body = $self->_prepare_body($apr); %args = %{$body->param}; - my $uri = URI->new($self->ar->uri); + my $uri = URI->new($self->ar->unparsed_uri); foreach my $key ($uri->query_param) { if (ref $args{$key}) { push (@{$args{$key}}, $uri->query_param($key));