Merge pull request #1 from gnustavo/rt-119790

Do not prepend default host to absolute URLs
This commit is contained in:
Kevin L. Kane 2017-01-10 15:59:32 -05:00 committed by GitHub
commit 182f91957d

View File

@ -102,8 +102,8 @@ The config flags are:
=item host =item host
A default host that will be prepended to all requests. Allows you to just A default host that will be prepended to all requests using relative URLs.
specify the path when making requests. Allows you to just specify the path when making requests.
The default is undef - you must include the host in your requests. The default is undef - you must include the host in your requests.
@ -476,6 +476,9 @@ sub _prepareURL {
my $self = shift; my $self = shift;
my $url = shift; my $url = shift;
# Do not prepend default host to absolute URLs.
return $url if $url =~ /^https?:/;
my $host = $self->getHost; my $host = $self->getHost;
if($host){ if($host){
$url = '/'.$url unless $url =~ /^\//; $url = '/'.$url unless $url =~ /^\//;