use HTTP::Daemon; use HTTP::Status; $d = new HTTP::Daemon; print "Please contact me at: <URL:", $d->url, ">\n"; while ($c = $d->accept) { $r = $c->get_request; if ($r) { if ($r->method eq 'GET' and $r->url->path eq "/xyzzy") { # this is *not* recommened practice $c->send_file_response("/etc/passwd"); } else { $c->send_error(RC_FORBIDDEN) } } $c = undef; # close connection }
In reply to Re: How do I write a simple webserver
by lhoward
in thread How do I write a simple webserver
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |