Skip Menu |
 

This queue is for tickets about the POE-Component-Client-HTTP CPAN distribution.

Report information
The Basics
Id: 63990
Status: resolved
Priority: 0/
Queue: POE-Component-Client-HTTP

People
Owner: Nobody in particular
Requestors: kozunov [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.895
Fixed in: (no value)



Subject: wrong header Host, when redirect is relative
Download (untitled) / with headers
text/plain 918b
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
Download (untitled) / with headers
text/plain 1.3k
I'm applying a slightly different patch. Apparently $new_uri->scheme() will be undef for a relative Location. That should be enough to detect the relative redirect, so I've eliminated $new_uri_save. Now... I need a site that responds with a relative redirect for testing. Would you happen to know one offhand? Thanks! On Thu Dec 16 13:00:18 2010, sergei wrote: Show quoted text
> 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 >
From: kozunov [...] gmail.com
Download (untitled) / with headers
text/plain 1.5k
Thank you for resolved my problems. This is domain http://pdd.yandex.ru make relative redirect. Срд Янв 26 23:46:20 2011, RCAPUTO писал: Show quoted text
> I'm applying a slightly different patch. Apparently $new_uri->scheme() > will be undef for a relative Location. That should be enough to detect > the relative redirect, so I've eliminated $new_uri_save. > > Now... I need a site that responds with a relative redirect for testing. > Would you happen to know one offhand? > > Thanks! > > On Thu Dec 16 13:00:18 2010, sergei wrote:
> > 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 > >
> >
http://pdd.yandex.ru seems to work now. Thank you for the help!


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.