… | |
… | |
149 | } |
149 | } |
150 | $res .= "\015\012"; |
150 | $res .= "\015\012"; |
151 | |
151 | |
152 | $res .= $content if defined $content and $self->{method} ne "HEAD"; |
152 | $res .= $content if defined $content and $self->{method} ne "HEAD"; |
153 | |
153 | |
154 | print STDERR "$self->{remote_addr} \"$self->{uri}\" $code ".$hdr->{"Content-Length"}." \"$self->{h}{referer}\"\n";#d# |
154 | print STDERR "$self->{remote_addr} \"$self->{uri}\" $code ".$hdr->{"Content-Length"}." \"$self->{h}{referer}\"\n"; |
155 | |
155 | |
156 | $self->{written} += |
156 | $self->{written} += |
157 | print {$self->{fh}} $res; |
157 | print {$self->{fh}} $res; |
158 | } |
158 | } |
159 | |
159 | |
… | |
… | |
381 | $self->err(301, "moved permanently", { Location => "http://$host$self->{uri}/" }); |
381 | $self->err(301, "moved permanently", { Location => "http://$host$self->{uri}/" }); |
382 | } else { |
382 | } else { |
383 | $ims < $self->{stat}[9] |
383 | $ims < $self->{stat}[9] |
384 | or $self->err(304, "not modified"); |
384 | or $self->err(304, "not modified"); |
385 | |
385 | |
386 | if ($self->{method} eq "GET") { |
|
|
387 | if (-r "$path/index.html") { |
386 | if (-r "$path/index.html") { |
388 | $self->{path} .= "/index.html"; |
387 | $self->{path} .= "/index.html"; |
389 | $self->handle_file; |
388 | $self->handle_file; |
390 | } else { |
389 | } else { |
391 | $self->handle_dir; |
390 | $self->handle_dir; |
392 | } |
|
|
393 | } |
391 | } |
394 | } |
392 | } |
395 | } elsif (-f _ && -r _) { |
393 | } elsif (-f _ && -r _) { |
396 | -x _ and $self->err(403, "forbidden"); |
394 | -x _ and $self->err(403, "forbidden"); |
397 | $self->handle_file; |
395 | $self->handle_file; |