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

Comparing AnyEvent-HTTP/README (file contents):
Revision 1.19 by root, Sat Feb 19 06:46:14 2011 UTC vs.
Revision 1.24 by root, Wed Nov 14 22:22:24 2012 UTC

106 Additional parameters are key-value pairs, and are fully optional. 106 Additional parameters are key-value pairs, and are fully optional.
107 They include: 107 They include:
108 108
109 recurse => $count (default: $MAX_RECURSE) 109 recurse => $count (default: $MAX_RECURSE)
110 Whether to recurse requests or not, e.g. on redirects, 110 Whether to recurse requests or not, e.g. on redirects,
111 authentication retries and so on, and how often to do so. 111 authentication and other retries and so on, and how often to do
112 so.
112 113
113 headers => hashref 114 headers => hashref
114 The request headers to use. Currently, "http_request" may 115 The request headers to use. Currently, "http_request" may
115 provide its own "Host:", "Content-Length:", "Connection:" and 116 provide its own "Host:", "Content-Length:", "Connection:" and
116 "Cookie:" headers and will provide defaults at least for "TE:", 117 "Cookie:" headers and will provide defaults at least for "TE:",
120 121
121 You really should provide your own "User-Agent:" header value 122 You really should provide your own "User-Agent:" header value
122 that is appropriate for your program - I wouldn't be surprised 123 that is appropriate for your program - I wouldn't be surprised
123 if the default AnyEvent string gets blocked by webservers sooner 124 if the default AnyEvent string gets blocked by webservers sooner
124 or later. 125 or later.
126
127 Also, make sure that your headers names and values do not
128 contain any embedded newlines.
125 129
126 timeout => $seconds 130 timeout => $seconds
127 The time-out to use for various stages - each connect attempt 131 The time-out to use for various stages - each connect attempt
128 will reset the timeout, as will read or write activity, i.e. 132 will reset the timeout, as will read or write activity, i.e.
129 this is not an overall timeout. 133 this is not an overall timeout.
333 337
334 Example: do a HTTP HEAD request on https://www.google.com/, use a 338 Example: do a HTTP HEAD request on https://www.google.com/, use a
335 timeout of 30 seconds. 339 timeout of 30 seconds.
336 340
337 http_request 341 http_request
338 GET => "https://www.google.com", 342 HEAD => "https://www.google.com",
339 headers => { "user-agent" => "MySearchClient 1.0" }, 343 headers => { "user-agent" => "MySearchClient 1.0" },
340 timeout => 30, 344 timeout => 30,
341 sub { 345 sub {
342 my ($body, $hdr) = @_; 346 my ($body, $hdr) = @_;
343 use Data::Dumper; 347 use Data::Dumper;
425 429
426 $AnyEvent::HTTP::MAX_RECURSE 430 $AnyEvent::HTTP::MAX_RECURSE
427 The default value for the "recurse" request parameter (default: 10). 431 The default value for the "recurse" request parameter (default: 10).
428 432
429 $AnyEvent::HTTP::TIMEOUT 433 $AnyEvent::HTTP::TIMEOUT
430 The default timeout for conenction operations (default: 300). 434 The default timeout for connection operations (default: 300).
431 435
432 $AnyEvent::HTTP::USERAGENT 436 $AnyEvent::HTTP::USERAGENT
433 The default value for the "User-Agent" header (the default is 437 The default value for the "User-Agent" header (the default is
434 "Mozilla/5.0 (compatible; U; AnyEvent-HTTP/$VERSION; 438 "Mozilla/5.0 (compatible; U; AnyEvent-HTTP/$VERSION;
435 +http://software.schmorp.de/pkg/AnyEvent)"). 439 +http://software.schmorp.de/pkg/AnyEvent)").
489 493
490 warn stat $fh; 494 warn stat $fh;
491 warn -s _; 495 warn -s _;
492 if (stat $fh and -s _) { 496 if (stat $fh and -s _) {
493 $ofs = -s _; 497 $ofs = -s _;
494 warn "-s is ", $ofs;#d# 498 warn "-s is ", $ofs;
495 $hdr{"if-unmodified-since"} = AnyEvent::HTTP::format_date +(stat _)[9]; 499 $hdr{"if-unmodified-since"} = AnyEvent::HTTP::format_date +(stat _)[9];
496 $hdr{"range"} = "bytes=$ofs-"; 500 $hdr{"range"} = "bytes=$ofs-";
497 } 501 }
498 502
499 http_get $url, 503 http_get $url,

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines