]> git.decadent.org.uk Git - maypole.git/blobdiff - lib/CGI/Maypole.pm
minor refactoring of redirect_request
[maypole.git] / lib / CGI / Maypole.pm
index 27b74f261d4cf4bf20c1d1c01a0efe47c0d39dcc..9b2ee7988faaf69d7f8451d06436758219094468 100644 (file)
@@ -76,17 +76,6 @@ sub get_request
     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
@@ -150,7 +139,7 @@ sub redirect_request
       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});
@@ -162,6 +151,17 @@ sub redirect_request
   return;
 }
 
+=item get_protocol
+
+=cut
+
+sub get_protocol 
+{
+  my $self = shift;
+  my $protocol = ($self->cgi->https) ? 'https' : 'http';
+  return $protocol;
+}
+
 =item send_output
 
 =cut