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.68 by root, Mon May 20 04:08:03 2002 UTC vs.
Revision 1.72 by root, Tue Sep 10 03:08:03 2002 UTC

55our $httpevent = new Coro::Signal; 55our $httpevent = new Coro::Signal;
56 56
57our $queue_file = new transferqueue $MAX_TRANSFERS; 57our $queue_file = new transferqueue $MAX_TRANSFERS;
58our $queue_index = new transferqueue 10; 58our $queue_index = new transferqueue 10;
59 59
60our $tbf_top = new tbf rate => 200000; 60our $tbf_top = new tbf rate => $TBF_RATE || 100000;
61 61
62my $unused_bytes = 0; 62my $unused_bytes = 0;
63my $unused_last = time; 63my $unused_last = time;
64 64
65sub unused_bandwidth { 65sub unused_bandwidth {
110 if (@pool) { 110 if (@pool) {
111 (pop @pool)->ready; 111 (pop @pool)->ready;
112 } else { 112 } else {
113 async \&handler; 113 async \&handler;
114 } 114 }
115
116 } 115 }
117 }; 116 };
118} 117}
119 118
120my $http_port = new Coro::Socket 119my $http_port = new Coro::Socket
232 $hdr->{"Content-Length"} = length $content; 231 $hdr->{"Content-Length"} = length $content;
233 $GZ = sprintf "GZ%02d", 100 - 100*((length $content) / $orig); 232 $GZ = sprintf "GZ%02d", 100 - 100*((length $content) / $orig);
234 } 233 }
235 234
236 $res .= "Date: $HTTP_NOW\015\012"; 235 $res .= "Date: $HTTP_NOW\015\012";
236 $res .= "Server: $::NAME\015\012";
237 237
238 while (my ($h, $v) = each %$hdr) { 238 while (my ($h, $v) = each %$hdr) {
239 $res .= "$h: $v\015\012" 239 $res .= "$h: $v\015\012"
240 } 240 }
241 $res .= "\015\012"; 241 $res .= "\015\012";
568 568
569 $self->response(@code, $hdr, ""); 569 $self->response(@code, $hdr, "");
570 570
571 if ($self->{method} eq "GET") { 571 if ($self->{method} eq "GET") {
572 $self->{time} = $::NOW; 572 $self->{time} = $::NOW;
573 $self->{written} = 0;
573 574
574 my $current = $Coro::current; 575 my $current = $Coro::current;
575 576
576 my ($fh, $buf, $r); 577 my ($fh, $buf, $r);
577 578
593 while ($h > 0) { 594 while ($h > 0) {
594 unless ($locked) { 595 unless ($locked) {
595 if ($locked ||= $transfer->try($::WAIT_INTERVAL)) { 596 if ($locked ||= $transfer->try($::WAIT_INTERVAL)) {
596 $bufsize = $::BUFSIZE; 597 $bufsize = $::BUFSIZE;
597 $self->{time} = $::NOW; 598 $self->{time} = $::NOW;
599 $self->{written} = 0;
598 } 600 }
599 } 601 }
600 602
601 if ($blocked{$self->{remote_id}}) { 603 if ($blocked{$self->{remote_id}}) {
602 $self->{h}{connection} = "close"; 604 $self->{h}{connection} = "close";

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines