I have been trying to make asynchronous requests using Perl AnyEvent HTTP module with the following code.
my $headers = {
'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Language'=> 'en-us,en;q=0.5',
'Connection' => 'keep-alive'
};
$request = http_request (
GET => "$url",
timeout => 5, # seconds
# persistent => 1,
# keepalive => 1,
headers => $headers,
proxy => $proxyRef,
sub {
my ($body, $hdr) = @_;
}
);
I keep getting the following response from the request:
{
'Reason' => 'Connection timed out',
'URL' => 'url requested',
'Status' => 595
};
I've been checking the AnyEvent Documentation for reasons for this error, but haven't been successful with that. Cant find other useful threads on this issue except suggestions to retry on timeout, which yields the same result. A simple 'wget' works on the same URL and its alive. Could anyone point out on how to debug this issue?