… | |
… | |
448 | } |
448 | } |
449 | } |
449 | } |
450 | } elsif (-f _ && -r _) { |
450 | } elsif (-f _ && -r _) { |
451 | -x _ and $self->err(403, "forbidden"); |
451 | -x _ and $self->err(403, "forbidden"); |
452 | |
452 | |
453 | if (%{$conn{$self->{remote_id}}} > $::MAX_TRANSFERS_IP) { |
453 | if (keys %{$conn{$self->{remote_id}}} > $::MAX_TRANSFERS_IP) { |
454 | my $timeout = $::NOW + 10; |
454 | my $timeout = $::NOW + 10; |
455 | while (%{$conn{$self->{remote_id}}} > $::MAX_TRANSFERS_IP) { |
455 | while (keys %{$conn{$self->{remote_id}}} > $::MAX_TRANSFERS_IP) { |
456 | if ($timeout < $::NOW) { |
456 | if ($timeout < $::NOW) { |
457 | $self->block($::BLOCKTIME, "too many connections"); |
457 | $self->block($::BLOCKTIME, "too many connections"); |
458 | } else { |
458 | } else { |
459 | $httpevent->wait; |
459 | $httpevent->wait; |
460 | } |
460 | } |
… | |
… | |
509 | |
509 | |
510 | satisfiable: |
510 | satisfiable: |
511 | # check for segmented downloads |
511 | # check for segmented downloads |
512 | if ($l && $::NO_SEGMENTED) { |
512 | if ($l && $::NO_SEGMENTED) { |
513 | my $timeout = $::NOW + 15; |
513 | my $timeout = $::NOW + 15; |
514 | while (%{$uri{$self->{remote_id}}{$self->{uri}}} > 1) { |
514 | while (keys %{$uri{$self->{remote_id}}{$self->{uri}}} > 1) { |
515 | if ($timeout <= $::NOW) { |
515 | if ($timeout <= $::NOW) { |
516 | $self->block($::BLOCKTIME, "segmented downloads are forbidden"); |
516 | $self->block($::BLOCKTIME, "segmented downloads are forbidden"); |
517 | #$self->err_segmented_download; |
517 | #$self->err_segmented_download; |
518 | } else { |
518 | } else { |
519 | $httpevent->wait; |
519 | $httpevent->wait; |
… | |
… | |
566 | } |
566 | } |
567 | } |
567 | } |
568 | |
568 | |
569 | if ($blocked{$self->{remote_id}}) { |
569 | if ($blocked{$self->{remote_id}}) { |
570 | $self->{h}{connection} = "close"; |
570 | $self->{h}{connection} = "close"; |
571 | die bless {}, err:: |
571 | die bless {}, err::; |
572 | } |
572 | } |
573 | |
573 | |
574 | if (0) { # !AIO |
574 | if (0) { # !AIO |
575 | sysread $fh, $buf, $h > $bufsize ? $bufsize : $h |
575 | sysread $fh, $buf, $h > $bufsize ? $bufsize : $h |
576 | or last; |
576 | or last; |