Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: cpan [...] backweave.com
Cc:
AdminCc:

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



Subject: Host header not updated for redirects
POE::Component::Client::HTTP 0.57 Perl 5.6.1 Linux 2.4.19 The host header is apparently not updated for redirects. If FollowRedirects is set to 1, and we post a HTTP::Request(GET => 'http://google.com/'), Initial request (unimportant details removed): GET http://google.com/ Host: google.com Redirected request: GET http://www.google.com/ Host: google.com The host remains google.com even though the URI in the GET line has changed. The end result of this is that one gets an unending (limited by FollowRedirects) series of 302 responses, instead of a 200 OK response on the first redirect. Jeff
[guest - Thu Sep 18 04:59:15 2003]: Show quoted text
> > POE::Component::Client::HTTP 0.57 > Perl 5.6.1 > Linux 2.4.19 > > The host header is apparently not updated for redirects. If > FollowRedirects is set to 1, and we post a HTTP::Request(GET => > 'http://google.com/'), > > Initial request (unimportant details removed): > GET http://google.com/ > Host: google.com > > Redirected request: > GET http://www.google.com/ > Host: google.com > > The host remains google.com even though the URI in the GET line has > changed. The end result of this is that one gets an unending > (limited by FollowRedirects) series of 302 responses, instead of a > 200 OK response on the first redirect. > > Jeff
Good morning. I've looked through the code and don't see where this issue has been resolved. Could you supply a short test case for the problem? Thank you. -- Rocco Caputo - rcaputo@pobox.com - http://poe.perl.org/
[RCAPUTO - Fri Nov 21 10:33:40 2003]: Show quoted text
> Good morning. I've looked through the code and don't see where this
Show quoted text
> issue has been resolved. Could you supply a short test case for the
Show quoted text
> problem?
Show quoted text
>
Show quoted text
> Thank you.
Hi, Notice that the status code is 302 in both the original and the redirected request. Jeff ######################## !/usr/bin/perl use strict; use warnings; use HTTP::Request; use POE; use POE::Component::Client::HTTP; my $url = "http://google.com/"; POE::Component::Client::HTTP->spawn(Alias => 'ua', FollowRedirects => 1); POE::Session->create(inline_states => { _start => \&start, got_response => \&got_response }); $poe_kernel->run(); sub start { $_[KERNEL]->post("ua", "request", "got_response", HTTP::Request->new(GET => $url)); } sub got_response { my $r = $_[ARG1]->[0]; while($r) { print $r->request->as_string, "\n"; print $r->status_line, "\n"; print $r->content; print "\n\n******\n\n"; $r = $r->previous; } }
Thanks for the test case. I've uploaded version 0.59 to PAUSE with proper Host rewriting on redirects. It should reach Your Favorite CPAN Mirror shortly. -- Rocco Caputo - rcaputo@pobox.com - http://poe.perl.org/