ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent-HTTP/HTTP.pm
(Generate patch)

Comparing AnyEvent-HTTP/HTTP.pm (file contents):
Revision 1.89 by root, Mon Jan 3 00:23:25 2011 UTC vs.
Revision 1.90 by root, Mon Jan 3 00:41:25 2011 UTC

169C<Host:>, C<Content-Length:>, C<Connection:> and C<Cookie:> headers and 169C<Host:>, C<Content-Length:>, C<Connection:> and C<Cookie:> headers and
170will provide defaults at least for C<TE:>, C<Referer:> and C<User-Agent:> 170will provide defaults at least for C<TE:>, C<Referer:> and C<User-Agent:>
171(this can be suppressed by using C<undef> for these headers in which case 171(this can be suppressed by using C<undef> for these headers in which case
172they won't be sent at all). 172they won't be sent at all).
173 173
174You really should provide your own C<User-Agent:> header value that is
175appropriate for your program - I wouldn't be surprised if the default
176AnyEvent string gets blocked by webservers sooner or later.
177
174=item timeout => $seconds 178=item timeout => $seconds
175 179
176The time-out to use for various stages - each connect attempt will reset 180The time-out to use for various stages - each connect attempt will reset
177the timeout, as will read or write activity, i.e. this is not an overall 181the timeout, as will read or write activity, i.e. this is not an overall
178timeout. 182timeout.
329Example: do a HTTP HEAD request on https://www.google.com/, use a 333Example: do a HTTP HEAD request on https://www.google.com/, use a
330timeout of 30 seconds. 334timeout of 30 seconds.
331 335
332 http_request 336 http_request
333 GET => "https://www.google.com", 337 GET => "https://www.google.com",
338 headers => { "user-agent" => "MySearchClient 1.0" },
334 timeout => 30, 339 timeout => 30,
335 sub { 340 sub {
336 my ($body, $hdr) = @_; 341 my ($body, $hdr) = @_;
337 use Data::Dumper; 342 use Data::Dumper;
338 print Dumper $hdr; 343 print Dumper $hdr;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines