App-Foca
view release on metacpan or search on metacpan
Runs the HTTP::Daemon server. it forks on each request.
prepare_status_response()
Prepares a response (HTTP::Response) for the /status request. /status
requests returns some stats about Foca server, such as: number of active
connections, number of closed/zombie connections (user connected and
left the connection open with a process that is no longer needed).
prepare_foca_response($connection, $request)
Prepares a response (HTTP::Response) for a given foca request
(HTTP::Request).
build_response($code, $body)
Builds a HTTP response ("HTTP::Response") based on the given HTTP status
code and optionally adds a body.
Returns a "HTTP::Response" so it can be send via the opened connection.
validate_request($command, $request)
re-define this method if you want to add some extra security. By default
all requests are valid at this point.
lib/App/Foca/Server.pm view on Meta::CPAN
}
my $body = "active_connections: $active_connections\n";
$body .= "closed_connections: $closed_connections\n";
return $self->build_response(HTTP_OK, $body);
}
=head2 B<prepare_foca_response($connection, $request)>
Prepares a response (L<HTTP::Response>) for a given foca request (L<HTTP::Request>).
=cut
sub prepare_foca_response {
my ($self, $connection, $request) = @_;
my $headers = $request->headers;
my $method = $request->method;
# Ok, we getting GET or HEAD? the only ones we allow
if (grep($method eq uc $_, qw(GET HEAD))) {
# We got params?
( run in 0.565 second using v1.01-cache-2.11-cpan-de7293f3b23 )