use HTTP::Daemon;
use HTTP::Status;
my $d = new HTTP::Daemon;
$d = new HTTP::Daemon
LocalAddr => '',
LocalPort => 80;
print "Please contact me at: <URL:", $d->url, ">\n";
while (my $c = $d->accept) {
while (my $r = $c->get_request) {
warn $r->as_string;
if ($r->method eq 'GET' and $r->url->path eq "/") {
$c->send_file_response("./Dd21.txt");
} else {
$c->send_error(RC_FORBIDDEN)
}
}
$c->close;
undef($c);
}
exit;
D:\test>perl -w http_deamon_deamon.pl
Please contact me at: <URL:http://eizi/>
GET / HTTP/1.1
Connection: Keep-Alive
Accept: */*
Accept-Encoding: gzip, deflate
Accept-Language: ja
Host: 219.209.188.83
If-Modified-Since: Tue, 27 Sep 2005 08:00:00 GMT
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Win 9x 4.90; Lunascape 2.0.3)