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.45 by root, Sun Nov 11 03:32:19 2001 UTC vs.
Revision 1.46 by root, Sat Nov 17 04:15:23 2001 UTC

183 183
184sub response { 184sub response {
185 my ($self, $code, $msg, $hdr, $content) = @_; 185 my ($self, $code, $msg, $hdr, $content) = @_;
186 my $res = "HTTP/1.1 $code $msg\015\012"; 186 my $res = "HTTP/1.1 $code $msg\015\012";
187 187
188 if (exists $hdr->{Connection}) {
189 if ($hdr->{Connection} =~ /close/) {
188 $self->{h}{connection} = "close" 190 $self->{h}{connection} = "close"
189 if exists $hdr->{Connection} # to avoid "empty" header lines due to vivification 191 }
190 and $hdr->{Connection} =~ /close/; 192 } else {
193 if ($self->{version} < 1.1) {
194 if ($self->{h}{connection} =~ /keep-alive/i) {
195 $hdr->{Connection} = "Keep-Alive";
196 } else {
197 $self->{h}{connection} = "close"
198 }
199 }
200 }
191 201
192 $res .= "Date: $HTTP_NOW\015\012"; 202 $res .= "Date: $HTTP_NOW\015\012";
193 203
194 while (my ($h, $v) = each %$hdr) { 204 while (my ($h, $v) = each %$hdr) {
195 $res .= "$h: $v\015\012" 205 $res .= "$h: $v\015\012"
340 350
341 $self->eoconn; 351 $self->eoconn;
342 352
343 die if $@ && !ref $@; 353 die if $@ && !ref $@;
344 354
345 last if $self->{h}{connection} =~ /close/ || $self->{version} < 1.1; 355 last if $self->{h}{connection} =~ /close/;
346 356
347 $httpevent->broadcast; 357 $httpevent->broadcast;
348 358
349 $fh->timeout($::PER_TIMEOUT); 359 $fh->timeout($::PER_TIMEOUT);
350 } 360 }
484 my $delay = $::NOW + $::PER_TIMEOUT + 15; 494 my $delay = $::NOW + $::PER_TIMEOUT + 15;
485 while (%{$uri{$self->{remote_id}}{$self->{uri}}} > 1) { 495 while (%{$uri{$self->{remote_id}}{$self->{uri}}} > 1) {
486 if ($delay <= $::NOW) { 496 if ($delay <= $::NOW) {
487 $self->err_segmented_download; 497 $self->err_segmented_download;
488 } else { 498 } else {
489 $httpevent->broadcast; 499 $httpevent->wait;
490 } 500 }
491 } 501 }
492 } 502 }
493 503
494 $hdr->{"Content-Range"} = "bytes $l-$h/$length"; 504 $hdr->{"Content-Range"} = "bytes $l-$h/$length";

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines