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

Comparing Coro/myhttpd/httpd.pl (file contents):
Revision 1.51 by root, Thu Nov 29 01:50:41 2001 UTC vs.
Revision 1.52 by root, Fri Nov 30 05:11:23 2001 UTC

34our $connections = new Coro::Semaphore $MAX_CONNECTS || 250; 34our $connections = new Coro::Semaphore $MAX_CONNECTS || 250;
35our $httpevent = new Coro::Signal; 35our $httpevent = new Coro::Signal;
36 36
37our $wait_factor = 0.95; 37our $wait_factor = 0.95;
38 38
39our @transfers = (
40 (new transferqueue $MAX_TRANSFERS_SMALL), 39our $queue_small = new transferqueue $MAX_TRANSFERS_SMALL;
41 (new transferqueue $MAX_TRANSFERS_LARGE), 40our $queue_large = new transferqueue $MAX_TRANSFERS_LARGE;
42); 41our $queue_index = new transferqueue 5;
43 42
44my @newcons; 43my @newcons;
45my @pool; 44my @pool;
46 45
47# one "execution thread" 46# one "execution thread"
448 or $self->err(304, "not modified"); 447 or $self->err(304, "not modified");
449 448
450 if (-r "$path/index.html") { 449 if (-r "$path/index.html") {
451 # replace directory "size" by index.html filesize 450 # replace directory "size" by index.html filesize
452 $self->{stat}[7] = (stat ($self->{path} .= "/index.html"))[7]; 451 $self->{stat}[7] = (stat ($self->{path} .= "/index.html"))[7];
453 $self->handle_file; 452 $self->handle_file($queue_index);
454 } else { 453 } else {
455 $self->handle_dir; 454 $self->handle_dir;
456 } 455 }
457 } 456 }
458 } elsif (-f _ && -r _) { 457 } elsif (-f _ && -r _) {
459 -x _ and $self->err(403, "forbidden"); 458 -x _ and $self->err(403, "forbidden");
460 $self->handle_file; 459 $self->handle_file(-s _ >= $::TRANSFER_SMALL ? $queue_large : $queue_small);
461 } else { 460 } else {
462 $self->err(404, "not found"); 461 $self->err(404, "not found");
463 } 462 }
464 } 463 }
465} 464}
477 }, 476 },
478 $idx); 477 $idx);
479} 478}
480 479
481sub handle_file { 480sub handle_file {
482 my $self = shift; 481 my ($self, $queue) = @_;
483 my $length = $self->{stat}[7]; 482 my $length = $self->{stat}[7];
484 my $queue = $::transfers[$length >= $::TRANSFER_SMALL];
485 my $hdr = { 483 my $hdr = {
486 "Last-Modified" => time2str ((stat _)[9]), 484 "Last-Modified" => time2str ((stat _)[9]),
487 }; 485 };
488 486
489 my @code = (200, "ok"); 487 my @code = (200, "ok");

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines