… | |
… | |
156 | $self->{time} = $::NOW; |
156 | $self->{time} = $::NOW; |
157 | |
157 | |
158 | weaken ($Coro::current->{conn} = $self); |
158 | weaken ($Coro::current->{conn} = $self); |
159 | |
159 | |
160 | $::conns++; |
160 | $::conns++; |
|
|
161 | $::maxconns = $::conns if $::conns > $::maxconns; |
161 | |
162 | |
162 | $self; |
163 | $self; |
163 | } |
164 | } |
164 | |
165 | |
165 | sub DESTROY { |
166 | sub DESTROY { |
… | |
… | |
446 | $ims < $self->{stat}[9] |
447 | $ims < $self->{stat}[9] |
447 | or $self->err(304, "not modified"); |
448 | or $self->err(304, "not modified"); |
448 | |
449 | |
449 | if (-r "$path/index.html") { |
450 | if (-r "$path/index.html") { |
450 | # replace directory "size" by index.html filesize |
451 | # replace directory "size" by index.html filesize |
451 | $self->{stat}[7] = (stat ($self->{path} .= "/index.html"))[7]; |
452 | $self->{stat} = [stat ($self->{path} .= "/index.html")]; |
452 | $self->handle_file($queue_index); |
453 | $self->handle_file($queue_index); |
453 | } else { |
454 | } else { |
454 | $self->handle_dir; |
455 | $self->handle_dir; |
455 | } |
456 | } |
456 | } |
457 | } |
… | |
… | |
469 | |
470 | |
470 | $self->response(200, "ok", |
471 | $self->response(200, "ok", |
471 | { |
472 | { |
472 | "Content-Type" => "text/html", |
473 | "Content-Type" => "text/html", |
473 | "Content-Length" => length $idx, |
474 | "Content-Length" => length $idx, |
474 | #d# directories change all the time, so X- |
|
|
475 | "X-Last-Modified" => time2str ((stat _)[9]), |
475 | "Last-Modified" => time2str ($self->{stat}[9]), |
476 | }, |
476 | }, |
477 | $idx); |
477 | $idx); |
478 | } |
478 | } |
479 | |
479 | |
480 | sub handle_file { |
480 | sub handle_file { |