Mark Overmeer > IOMux-HTTP > IOMux::HTTP::Server

Download:
IOMux-HTTP-0.11.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.11   Source  

NAME ^

IOMux::HTTP::Server - IOMux and LWP based HTTP server

INHERITANCE ^

 IOMux::HTTP::Server
   is a IOMux::Service::TCP
   is a IOMux::Handler::Service
   is a IOMux::Handler

SYNOPSIS ^

  my $mux  = IOMux::Poll->new;
  my $conn = IOMux::HTTP::Server->new(handler => \&h);
  $mux->add($conn);
  $mux->loop;

DESCRIPTION ^

This module implements a basic HTTP connection handler on a socket, using IOMux 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 IOMux::HTTP::Service.

See the examples/ directory in the distribution for a detailed template for a complete HTTP server.

METHODS ^

Constructors

IOMux::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  IOMux::Service::TCP  []
  conn_type  IOMux::Service::TCP  IOMux::HTTP::Service
  fh         IOMux::Handler   <required>
  handler                     <required>
  name       IOMux::Handler   'listen tcp $host:$port'
conn_opts => ARRAY
conn_type => CLASS|CODE
fh => FILEHANDLE
handler => CODE

The CODE points to the routine which get called when a new connection gets initialized.

name => STRING
IOMux::HTTP::Server->open(MODE, WHAT, OPTIONS) See "Constructors" in IOMux::Handler

Accessors

$obj->clientType See "Accessors" in IOMux::Service::TCP
$obj->fh See "Accessors" in IOMux::Handler
$obj->fileno See "Accessors" in IOMux::Handler
$obj->mux See "Accessors" in IOMux::Handler
$obj->name See "Accessors" in IOMux::Handler
$obj->socket See "Accessors" in IOMux::Service::TCP
$obj->usesSSL See "Accessors" in IOMux::Handler

User interface

Connection

$obj->close([CALLBACK]) See "Connection" in IOMux::Handler
$obj->timeout([TIMEOUT]) See "Connection" in IOMux::Handler

Multiplexer

Connection

$obj->mux_init(MUX, [HANDLER]) See "Connection" in IOMux::Handler
$obj->mux_remove See "Connection" in IOMux::Handler
$obj->mux_timeout See "Connection" in IOMux::Handler

Reading

$obj->mux_except_flagged(FILENO) See "Reading" in IOMux::Handler
$obj->mux_read_flagged(FILENO) See "Reading" in IOMux::Handler

Writing

$obj->mux_write_flagged(FILENO) See "Writing" in IOMux::Handler

Service

$obj->mux_connection(CLIENT) See "Service" in IOMux::Handler::Service

Helpers

$obj->extractSocket(HASH)
IOMux::HTTP::Server->extractSocket(HASH) See "Helpers" in IOMux::Handler
$obj->fdset(STATE, READ, WRITE, ERROR) See "Helpers" in IOMux::Handler
$obj->show See "Helpers" in IOMux::Handler

SEE ALSO ^

This module is part of IOMux-HTTP distribution version 0.11, built on January 27, 2011. Website: http://perl.overmeer.net/ All modules in this suite: "Any::Daemon", "IOMux", and "IOMux::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

syntax highlighting: