Thanks for your really *quick* reply!
Just wanted to add that if this is the intended behavior then there is a
different bug to report:
The second HTTP request ignores the header that was set in the initial
request. So, for example:
my $downloader=HTTP::Async->new;
my $request_header=HTTP::Headers->new(
User_Agent=>'My-Web-Client/0.01'
);
$downloader->add(HTTP::Request->new(GET=>'
http://www.deltahacker.gr/',$request_header));
while (my $response=$downloader->wait_for_next_response) {
print $response->code;
}
The above code will result in two HTTP requests. As I see in WireShark,
the first request has set the requested user-agent in the HTTP header.
The second one (redirected) has empty header.
Just reporting - no problem for my needs/use of the module.
Thanks!
On Wed Aug 29 11:20:45 2012, evdb@ecclestoad.co.uk wrote:
Show quoted text> On 29 August 2012 17:10, Nikos Mouratidis via RT
> <bug-HTTP-Async@rt.cpan.org> wrote:
> > Queue: HTTP-Async
> > Ticket <URL:
https://rt.cpan.org/Ticket/Display.html?id=79285 >
> >
> > In fact, the problem is not the two requests (this is probably due to
> > server redirection and the request is only one if "deltahacker.gr" is
> > used instead of "www.deltahacker.gr").
> >
> > The problem is that the redirection occurs when calling the
> > next_response or the wait_for_next_response methods.
>
> This is not a bug :)
>
> When you add the request to the async object the request is sent, but
> none of the response in inspected (it could take a while to return).
> Only once you call the next_response or wait_for.... methods does the
> code look at the response. In this case it sees that it is a 301 or
> 302 and sends the new request.
>
> So yes two requests are sent, but that can't really be avoided.
>
> I hope this makes sense?
>
> Cheers,
> Edmund.
>
>
> > BTW, I'm the same person that committed the bug. I just created a
> > bitcard account to clarify the situation.