Subject: | wrong header Host, when redirect is relative |
I create a request
$url = 123.123.123.123;#ip
my $r = HTTP::Request->new( 'GET', $url, [Host => 'myho.st']);
and recieve response
HTTP/1.1 302 Found
Location: /some/path/
then Client-HTTP create a request
GET /some/path/ HTTP/1.1
Host: 123.123.123.123
but this is wrong
I've patched sub check_redirect
my $new_uri = $self->[REQ_RESPONSE]->header ('Location');
my $new_uri_save = $new_uri; #add this string
#change header Host only if redirect is absolute
if ($new_uri eq $new_uri_save) { #add this string
DEBUG and warn "RED: redirect abs"; #add this string
_set_host_header ($newrequest); #add this string
} else { #add this string
DEBUG and warn "RED: redirect relative"; #add this string
} #add this string
#_set_host_header ($newrequest); #delete this string