… | |
… | |
183 | |
183 | |
184 | sub response { |
184 | sub 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 | $self->{h}{connection} = "close" if $hdr->{Connection} =~ /close/; |
188 | $self->{h}{connection} = "close" |
|
|
189 | if exists $hdr->{Connection} # to avoid "empty" header lines due to vivification |
|
|
190 | and $hdr->{Connection} =~ /close/; |
189 | |
191 | |
190 | $res .= "Date: $HTTP_NOW\015\012"; |
192 | $res .= "Date: $HTTP_NOW\015\012"; |
191 | |
193 | |
192 | while (my ($h, $v) = each %$hdr) { |
194 | while (my ($h, $v) = each %$hdr) { |
193 | $res .= "$h: $v\015\012" |
195 | $res .= "$h: $v\015\012" |
… | |
… | |
420 | } else { |
422 | } else { |
421 | $ims < $self->{stat}[9] |
423 | $ims < $self->{stat}[9] |
422 | or $self->err(304, "not modified"); |
424 | or $self->err(304, "not modified"); |
423 | |
425 | |
424 | if (-r "$path/index.html") { |
426 | if (-r "$path/index.html") { |
425 | $self->{path} .= "/index.html"; |
427 | # replace directory "size" by index.html filesize |
|
|
428 | $self->{stat}[7] = (stat ($self->{path} .= "/index.html"))[7]; |
426 | $self->handle_file; |
429 | $self->handle_file; |
427 | } else { |
430 | } else { |
428 | $self->handle_dir; |
431 | $self->handle_dir; |
429 | } |
432 | } |
430 | } |
433 | } |