Commit 13e86ea8 authored by Yadd's avatar Yadd
Browse files

#5 in progress : new method _buildUrl() that will be the only one to overload in VHosts.pm

parent 7fd3964c
...@@ -957,19 +957,23 @@ sub hideCookie { ...@@ -957,19 +957,23 @@ sub hideCookie {
sub encodeUrl { sub encodeUrl {
my ( $class, $url ) = splice @_; my ( $class, $url ) = splice @_;
my $u = $url; my $u = $url;
if ( $url !~ m#^https?://# ) { $url = $class->_buildUrl($url) if ( $url !~ m#^https?://# );
return encode_base64( $u, '' );
}
sub _buildUrl {
my ( $class, $s ) = splice @_;
my $portString = $port || $apacheRequest->get_server_port(); my $portString = $port || $apacheRequest->get_server_port();
$portString = $portString =
( $https && $portString == 443 ) ? '' ( $https && $portString == 443 ) ? ''
: ( !$https && $portString == 80 ) ? '' : ( !$https && $portString == 80 ) ? ''
: ':' . $portString; : ':' . $portString;
$u = "http" return
"http"
. ( $https ? "s" : "" ) . "://" . ( $https ? "s" : "" ) . "://"
. $apacheRequest->get_server_name() . $apacheRequest->get_server_name()
. $portString . $portString
. $url; . $s;
}
return encode_base64( $u, '' );
} }
## @rmethod protected int goToPortal(string url, string arg) ## @rmethod protected int goToPortal(string url, string arg)
...@@ -1041,12 +1045,8 @@ sub run ($$) { ...@@ -1041,12 +1045,8 @@ sub run ($$) {
$class->lmLog( 'CDA request', 'debug' ); $class->lmLog( 'CDA request', 'debug' );
$apacheRequest->args($args); $apacheRequest->args($args);
my $host = $apacheRequest->get_server_name(); my $host = $apacheRequest->get_server_name();
my $portString = $port || $apacheRequest->get_server_port();
lmSetErrHeaderOut( $apacheRequest, lmSetErrHeaderOut( $apacheRequest,
'Location' => "http" $class->_buildUrl( $apacheRequest->uri )
. ( $https ? 's' : '' )
. "://$host:$portString"
. $apacheRequest->uri
. ( $args ? "?" . $args : "" ) ); . ( $args ? "?" . $args : "" ) );
$host =~ s/^[^\.]+\.(.*\..*$)/$1/; $host =~ s/^[^\.]+\.(.*\..*$)/$1/;
lmSetErrHeaderOut( lmSetErrHeaderOut(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment