sub get_request {
my ($self, $r) = @_;
- my $ar = (APACHE2) ? Apache2::Request->new($r) : Apache::Request->new($r);
+ my $ar = (APACHE2) ? Apache2::Request->new($r) : Apache::Request->instance($r);
$self->ar($ar);
}
-=item get_protocol
-
-=cut
-
-sub get_protocol {
- my $self = shift;
- my $protocol = ( $self->ar->protocol =~ m/https/i ) ? 'https' : 'http' ;
- return $protocol;
-}
-
=item parse_location
=cut
for (keys %headers) {
$self->headers_in->set($_, $headers{$_});
}
-
my $path = $self->ar->uri;
my $loc = $self->ar->location;
{
=cut
# FIXME: use headers_in to gather host and other information?
-sub redirect_request {
- my $self = shift;
+sub redirect_request
+{
+ my $r = shift;
my $redirect_url = $_[0];
my $status = "302";
if ($_[1]) {
if ($args{url}) {
$redirect_url = $args{url};
} else {
- my $path = $args{path} || $self->path;
- my $host = $args{domain} || $self->ar->hostname;
- my $protocol = $args{protocol} ||
- ( $self->ar->protocol =~ m/https/i ) ? 'https' : 'http' ;
+ 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}";
}
$status = $args{status} if ($args{status});
}
- $self->headers_out->set('Status' => $status);
- $self->headers_out->set('Location' => $redirect_url);
+ $r->headers_out->set('Status' => $status);
+ $r->headers_out->set('Location' => $redirect_url);
return OK;
}
+=item get_protocol
+
+=cut
+
+sub get_protocol {
+ my $self = shift;
+ my $protocol = ( $self->ar->protocol =~ m/https/i ) ? 'https' : 'http' ;
+ return $protocol;
+}
+
=item send_output
=cut