NAME
IO::Mux::HTTP::Server - IO::Mux and LWP based HTTP server
INHERITANCE
IO::Mux::HTTP::Server
is a IO::Mux::Service::TCP
is a IO::Mux::Handler::Service
is a IO::Mux::Handler
SYNOPSIS
my $mux = IO::Mux::Poll->new;
my $conn = IO::Mux::HTTP::Server->new(handler => \&h);
$mux->add($conn);
$mux->loop;
DESCRIPTION
This module implements a basic HTTP connection handler on a socket, using IO::Mux as basis. This server takes all requests in a single process, because it is shaped around a select
or poll
system call: multiple clients send data to a single process in parallel.
The server understands protocols HTTP version 0.9, 1.0, and 1.1. See HTTP::Server::Multiplex for a extended server implementation, mimicing Apache. The connection logic is implemented in IO::Mux::HTTP::Service.
See the examples/ directory in the distribution for a detailed template for a complete HTTP server.
METHODS
Constructors
- IO::Mux::HTTP::Server->new(OPTIONS)
-
One object will accept connections on one socket. When you have more sockets to listen on, each needs its own object.
You may extend the connection implementation.
-Option --Defined in --Default conn_opts IO::Mux::Service::TCP [] conn_type IO::Mux::Service::TCP IO::Mux::HTTP::Service fh IO::Mux::Handler <required> handler <required> name IO::Mux::Handler 'listen tcp $host:$port'
- IO::Mux::HTTP::Server->open(MODE, WHAT, OPTIONS) See "Constructors" in IO::Mux::Handler
Accessors
- $obj->clientType See "Accessors" in IO::Mux::Service::TCP
- $obj->fh See "Accessors" in IO::Mux::Handler
- $obj->fileno See "Accessors" in IO::Mux::Handler
- $obj->mux See "Accessors" in IO::Mux::Handler
- $obj->name See "Accessors" in IO::Mux::Handler
- $obj->socket See "Accessors" in IO::Mux::Service::TCP
- $obj->usesSSL See "Accessors" in IO::Mux::Handler
User interface
Connection
- $obj->close([CALLBACK]) See "Connection" in IO::Mux::Handler
- $obj->timeout([TIMEOUT]) See "Connection" in IO::Mux::Handler
Multiplexer
Connection
- $obj->mux_init(MUX, [HANDLER]) See "Connection" in IO::Mux::Handler
- $obj->mux_remove See "Connection" in IO::Mux::Handler
- $obj->mux_timeout See "Connection" in IO::Mux::Handler
Reading
- $obj->mux_except_flagged(FILENO) See "Reading" in IO::Mux::Handler
- $obj->mux_read_flagged(FILENO) See "Reading" in IO::Mux::Handler
Writing
- $obj->mux_write_flagged(FILENO) See "Writing" in IO::Mux::Handler
Service
- $obj->mux_connection(CLIENT) See "Service" in IO::Mux::Handler::Service
Helpers
- $obj->extractSocket(HASH)
- IO::Mux::HTTP::Server->extractSocket(HASH) See "Helpers" in IO::Mux::Handler
- $obj->fdset(STATE, READ, WRITE, ERROR) See "Helpers" in IO::Mux::Handler
- $obj->show See "Helpers" in IO::Mux::Handler
SEE ALSO
This module is part of IO-Mux-HTTP distribution version 0.10, built on January 26, 2011. Website: http://perl.overmeer.net/ All modules in this suite: "Any::Daemon", "IO::Mux", and "IO::Mux::HTTP".
Please post questions or ideas to perl@overmeer.net
LICENSE
Copyrights 2011 by Mark Overmeer. For other contributors see ChangeLog.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://www.perl.com/perl/misc/Artistic.html