$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
=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
shift->cgi( CGI::Simple->new );
}
-=item get_protocol
-
-=cut
-
-sub get_protocol
-{
- my $self = shift;
- my $protocol = ($self->cgi->https) ? 'https' : 'http';
- return $protocol;
-}
-
=item parse_location
=cut
my $path = $args{path} || $r->cgi->url(-absolute => 1, -query=>1);
my $host = $args{domain};
($host = $r->cgi->url(-base => 1)) =~ s/^https?:\/\///i unless ($host);
- my $protocol = $args{protocol} || ($r->cgi->https()) ? 'https' : 'http';
+ my $protocol = $args{protocol} || $r->get_protocol;
$redirect_url = "${protocol}://${host}/${path}";
}
$status = $args{status} if ($args{status});
return;
}
+=item get_protocol
+
+=cut
+
+sub get_protocol
+{
+ my $self = shift;
+ my $protocol = ($self->cgi->https) ? 'https' : 'http';
+ return $protocol;
+}
+
=item send_output
=cut