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.46 by root, Sat Nov 17 04:15:23 2001 UTC vs.
Revision 1.47 by root, Tue Nov 20 01:56:21 2001 UTC

3use Coro::Event; 3use Coro::Event;
4use Coro::Socket; 4use Coro::Socket;
5use Coro::Signal; 5use Coro::Signal;
6 6
7use HTTP::Date; 7use HTTP::Date;
8use POSIX ();
8 9
9no utf8; 10no utf8;
10use bytes; 11use bytes;
11 12
12# at least on my machine, this thingy serves files 13# at least on my machine, this thingy serves files
206 } 207 }
207 $res .= "\015\012"; 208 $res .= "\015\012";
208 209
209 $res .= $content if defined $content and $self->{method} ne "HEAD"; 210 $res .= $content if defined $content and $self->{method} ne "HEAD";
210 211
212 my $log = (POSIX::strftime "%Y-%m-%d %H:%M:%S", gmtime $NOW).
211 my $log = "$self->{remote_addr} \"$self->{uri}\" $code ".$hdr->{"Content-Length"}." \"$self->{h}{referer}\"\n"; 213 " $self->{remote_addr} \"$self->{uri}\" $code ".$hdr->{"Content-Length"}." \"$self->{h}{referer}\"\n";
212 214
213 print $accesslog $log if $accesslog; 215 print $accesslog $log if $accesslog;
214 print STDERR $log; 216 print STDERR $log;
215 217
216 $self->{written} += 218 $self->{written} +=
455 457
456 $self->response(200, "ok", 458 $self->response(200, "ok",
457 { 459 {
458 "Content-Type" => "text/html", 460 "Content-Type" => "text/html",
459 "Content-Length" => length $idx, 461 "Content-Length" => length $idx,
462 "Last-Modified" => time2str ((stat _)[9]),
460 }, 463 },
461 $idx); 464 $idx);
462} 465}
463 466
464sub handle_file { 467sub handle_file {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines