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

Comparing AnyEvent-HTTP/README (file contents):
Revision 1.25 by root, Sun Jun 8 23:33:28 2014 UTC vs.
Revision 1.27 by root, Sun Aug 28 09:31:29 2016 UTC

146 146
147 $scheme must be either missing or must be "http" for HTTP. 147 $scheme must be either missing or must be "http" for HTTP.
148 148
149 If not specified, then the default proxy is used (see 149 If not specified, then the default proxy is used (see
150 "AnyEvent::HTTP::set_proxy"). 150 "AnyEvent::HTTP::set_proxy").
151
152 Currently, if your proxy requires authorization, you have to
153 specify an appropriate "Proxy-Authorization" header in every
154 request.
151 155
152 body => $string 156 body => $string
153 The request body, usually empty. Will be sent as-is (future 157 The request body, usually empty. Will be sent as-is (future
154 versions of this module might offer more options). 158 versions of this module might offer more options).
155 159
393 save cookies to disk, and you should call this function after 397 save cookies to disk, and you should call this function after
394 loading them again. If you have a long-running program you can 398 loading them again. If you have a long-running program you can
395 additionally call this function from time to time. 399 additionally call this function from time to time.
396 400
397 A cookie jar is initially an empty hash-reference that is managed by 401 A cookie jar is initially an empty hash-reference that is managed by
398 this module. It's format is subject to change, but currently it is 402 this module. Its format is subject to change, but currently it is as
399 like this: 403 follows:
400 404
401 The key "version" has to contain 1, otherwise the hash gets emptied. 405 The key "version" has to contain 1, otherwise the hash gets emptied.
402 All other keys are hostnames or IP addresses pointing to 406 All other keys are hostnames or IP addresses pointing to
403 hash-references. The key for these inner hash references is the 407 hash-references. The key for these inner hash references is the
404 server path for which this cookie is meant, and the values are again 408 server path for which this cookie is meant, and the values are again
445 "Mozilla/5.0 (compatible; U; AnyEvent-HTTP/$VERSION; 449 "Mozilla/5.0 (compatible; U; AnyEvent-HTTP/$VERSION;
446 +http://software.schmorp.de/pkg/AnyEvent)"). 450 +http://software.schmorp.de/pkg/AnyEvent)").
447 451
448 $AnyEvent::HTTP::MAX_PER_HOST 452 $AnyEvent::HTTP::MAX_PER_HOST
449 The maximum number of concurrent connections to the same host 453 The maximum number of concurrent connections to the same host
450 (identified by the hostname). If the limit is exceeded, then the 454 (identified by the hostname). If the limit is exceeded, then
451 additional requests are queued until previous connections are 455 additional requests are queued until previous connections are
452 closed. Both persistent and non-persistent connections are counted 456 closed. Both persistent and non-persistent connections are counted
453 in this limit. 457 in this limit.
454 458
455 The default value for this is 4, and it is highly advisable to not 459 The default value for this is 4, and it is highly advisable to not
496 or die "$file: $!"; 500 or die "$file: $!";
497 501
498 my %hdr; 502 my %hdr;
499 my $ofs = 0; 503 my $ofs = 0;
500 504
501 warn stat $fh;
502 warn -s _;
503 if (stat $fh and -s _) { 505 if (stat $fh and -s _) {
504 $ofs = -s _; 506 $ofs = -s _;
505 warn "-s is ", $ofs; 507 warn "-s is ", $ofs;
506 $hdr{"if-unmodified-since"} = AnyEvent::HTTP::format_date +(stat _)[9]; 508 $hdr{"if-unmodified-since"} = AnyEvent::HTTP::format_date +(stat _)[9];
507 $hdr{"range"} = "bytes=$ofs-"; 509 $hdr{"range"} = "bytes=$ofs-";
535 my (undef, $hdr) = @_; 537 my (undef, $hdr) = @_;
536 538
537 my $status = $hdr->{Status}; 539 my $status = $hdr->{Status};
538 540
539 if (my $time = AnyEvent::HTTP::parse_date $hdr->{"last-modified"}) { 541 if (my $time = AnyEvent::HTTP::parse_date $hdr->{"last-modified"}) {
540 utime $fh, $time, $time; 542 utime $time, $time, $fh;
541 } 543 }
542 544
543 if ($status == 200 || $status == 206 || $status == 416) { 545 if ($status == 200 || $status == 206 || $status == 416) {
544 # download ok || resume ok || file already fully downloaded 546 # download ok || resume ok || file already fully downloaded
545 $cb->(1, $hdr); 547 $cb->(1, $hdr);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines