Any-Daemon-HTTP

 view release on metacpan or  search on metacpan

lib/Any/Daemon/HTTP.pod  view on Meta::CPAN

This parameter/method is typically used to (re)connect to the database,
or setup logging.

=item $obj-E<gt>B<newConnection>($session)

[0.28] Called by default when a new client has been accepted.
See L<run(new_connection)|Any::Daemon::HTTP/"Action">.

=item $obj-E<gt>B<psTitle>($string)

=item $obj-E<gt>B<run>(%options)

When there is no vhost yet, one will be created.  When only one vhost
is active, you may pass C<handle_request> (see the vhost docs).

 -Option            --Defined in     --Default
  background          Any::Daemon      <true>
  child_died          Any::Daemon      'childDied'
  child_task          Any::Daemon      <accept http connections>
  kill_childs         Any::Daemon      'killChilds'
  linger                               undef
  max_childs          Any::Daemon      10
  max_conn_per_child                   10_000
  max_req_per_child                    100_000
  max_req_per_conn                     100
  max_time_per_conn                    120
  new_child                            'newChild'
  new_connection                       'newConnection'
  reconfigure         Any::Daemon      'reconfigDaemon'
  req_time_bonus                       5
  run_task            Any::Daemon      undef

=over 2

=item background => BOOLEAN

=item child_died => CODE|METHOD

=item child_task => CODE|METHOD

=item kill_childs => CODE|METHOD

=item linger => SECONDS

When defined, it sets the maximim time a client may stay connected
to collect the data after the connection is closed by the server.
When zero, the last response may get lost, because the connection gets
reset immediately.  Without linger, browsers may block the server
resource for a long time.  So, a linger of a few seconds (when you only
have small files) will help protecting your server.

This setting determines the minimum time for a save server reboot.  When
the daemon is stopped, the client may still keeps its socket.  The restart
of the server may fail with "socket already in use".

=item max_childs => INTEGER

=item max_conn_per_child => INTEGER

[0.24] Average maximum number of connections which are handled
per process, before it commits suicide to cleanup garbaged memory.
The parent will start a new process.

This value gets a random value in 10% range added to subtracted to avoid
that all childs reset at the same time.  So, for the default value, 9_000
upto 11_000 connections will be served before a reset.

=item max_req_per_child => INTEGER

[0.24] maximum number of HTTP requests accepted by all connections for
one process.

=item max_req_per_conn => INTEGER

[0.24] maximum number of HTTP requests handled in one connection.

=item max_time_per_conn => SECONDS

Maximum time a connection will stay alive.  When the time expires, the
process will forcefully killed.  For each request, C<req_time_bonus>
seconds are added.  This may be a bit short when your files are large.

=item new_child => CODE|METHOD

[0.28] run code when a new child process is started.  This will run
before the task starts waiting for connections.  See L<newChild()|Any::Daemon::HTTP/"Action">

=item new_connection => CODE|METHOD

The CODE is called on each new connection made.  It gets as parameters
the server (this object) and the connection (an
L<Any::Daemon::HTTP::Session|Any::Daemon::HTTP::Session> extension).

[0.28] Also a METHOD name.  See L<newConnection()|Any::Daemon::HTTP/"Action">

=item reconfigure => CODE|METHOD

=item req_time_bonus => SECONDS

=item run_task => CODE|METHOD

=back

=back

=head1 DETAILS

=head2 Server supported features

Many often used features are supported

=over 4

=item * HTTP/1.1 protocol

Supported by via the HTTP::Daemon connection implementation, which
is gracefully hijacked.  Messages are HTTP::Request and HTTP::Response
objects, borrowed from LWP.

=item * virtual hosts



( run in 0.790 second using v1.01-cache-2.11-cpan-13bb782fe5a )