Do not prepend default host to absolute URLs

Issue: https://rt.cpan.org/Ticket/Display.html?id=119790
This commit is contained in:
Gustavo L. de M. Chaves 2017-01-10 16:46:14 -02:00
parent c70df145f0
commit 3cb20d8f8c

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 =~ /^\//;