HTTP::Server::Simple - small embedded HTTP server
$server.run; # says "alive" on port 8080
Normally one would use a class that wraps this server with a familiar
web API, such as CGI, FastCGI or PSGI. HTTP::Server::Simple is a role
that classes can import with a 'does'. For example:
class HTTP::Server::Simple::Example does HTTP::Server::Simple;
This is a Perl 6 re-implementation of the Perl 5 HTTP::Server::Simple.
Web applications generally do use this directly, but use a subclass such
as HTTP::Server::Simple::CGI, or similar ones based on FastCGI or PSGI.
The server's IP address (rw)
The port server is to run on (ro)
Construct and return a server object. The optional argument is a port
number (default 8080). The server begins to listen and accept incoming
connections on the port when the run method is executed.
Start the server as foreground process in an infinite loop. The server
is either a Net::Server, a subclass of that, or (default) a minimal
emulation of it.
Fork and run the child process as a server daemon. Not Yet Implemented.
Called from process_request . Sends a default response to the client.
Called with named parameters: method, protocol, request_uri, path,
query_string, port, peername, peeraddr, localname.
As in the Perl 5 version, the default setup handler takes each
tries to call
Announces on the console that the server is running.
Called from _default_run . Calls getpeername , valid_http_method ,
setup , parse_headers , headers , post_setup_hook ,
Prepares the server TCP socket up to the bind and listen operations.
Called from run .
Called by run as an event hook, the default handler does nothing.
Refactor and re-structure if necessary to be more compatible with the
Perl 5 version. This requires testing with webserver applications that
have been ported.
Most of the code was inspired by the following Perl 5 modules:
L<HTTP::Server::Simple> L<Net::Server> L<HTTP::Daemon>