ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/Coro/myhttpd/httpd.pl
(Generate patch)

Comparing cvsroot/Coro/myhttpd/httpd.pl (file contents):
Revision 1.95 by root, Wed Apr 24 23:49:34 2013 UTC vs.
Revision 1.96 by root, Sun Mar 1 08:35:45 2020 UTC

549 if ($self->{h}{range} =~ /^bytes=(.*)$/i) { 549 if ($self->{h}{range} =~ /^bytes=(.*)$/i) {
550 for (split /,/, $1) { 550 for (split /,/, $1) {
551 if (/^-(\d+)$/) { 551 if (/^-(\d+)$/) {
552 ($l, $h) = ($length - $1, $length - 1); 552 ($l, $h) = ($length - $1, $length - 1);
553 } elsif (/^(\d+)-(\d*)$/) { 553 } elsif (/^(\d+)-(\d*)$/) {
554 ($l, $h) = ($1, ($2 ne "" || $2 >= $length) ? $2 : $length - 1); 554 ($l, $h) = ($1, ($2 eq "" || $2 >= $length) ? $length - 1 : $2);
555 } else { 555 } else {
556 ($l, $h) = (0, $length - 1); 556 ($l, $h) = (0, $length - 1);
557 goto ignore; 557 goto ignore;
558 } 558 }
559 goto satisfiable if $l >= 0 && $l < $length && $h >= 0 && $h >= $l; 559 goto satisfiable if $l >= 0 && $l < $length && $h >= 0 && $h >= $l;
563 $self->err (416, "not satisfiable", $hdr, ""); 563 $self->err (416, "not satisfiable", $hdr, "");
564 564
565satisfiable: 565satisfiable:
566 # check for segmented downloads 566 # check for segmented downloads
567 if ($l && $::NO_SEGMENTED) { 567 if ($l && $::NO_SEGMENTED) {
568 my $timeout = $::NOW + 60; 568 my $timeout = $::NOW + 0;
569 while (keys %{$uri{$self->{remote_id}}{$self->{uri}}} > 1) { 569 while (keys %{$uri{$self->{remote_id}}{$self->{uri}}} > 1) {
570 if ($timeout <= $::NOW) { 570 if ($timeout <= $::NOW) {
571 $self->err_segmented_download; 571 $self->err_segmented_download;
572 } else { 572 } else {
573 Coro::AnyEvent::sleep 1;
573 $httpevent->wait; 574 #$httpevent->wait;
574 } 575 }
575 } 576 }
576 } 577 }
577 578
578 $hdr->{"Content-Range"} = "bytes $l-$h/$length"; 579 $hdr->{"Content-Range"} = "bytes $l-$h/$length";
630 my $w = $self->{fh}->syswrite ($buf) 631 my $w = $self->{fh}->syswrite ($buf)
631 or last; 632 or last;
632 $::written += $w; 633 $::written += $w;
633 $self->{written} += $w; 634 $self->{written} += $w;
634 $l += $w; 635 $l += $w;
636 $h -= $w;
635 } 637 }
636 638
637 close $fh; 639 close $fh;
638 } 640 }
639} 641}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines