Cro::FCGI

FastCGI support for Cro

NAME

Cro::FCGI

FastCGI support for Cro

Synopsis

Using a network connection

use Cro::FCGI::Server;

my $service = Cro::FCGI::Server.new(
    host => '127.0.0.1',
    port => 43210,
    application => MyCroApp
);
$service.start;

Webserver config (Apache here):

Listen 43210
<VirtualHost 127.0.0.1:43210>
    ProxyFCGIBackendType GENERIC
    ProxyPass "/" "fcgi://127.0.0.1:43211/" enablereuse=on
</VirtualHost>

Using a Unix socket

use Cro::FCGI::Server;

my $service = Cro::FCGI::Server.new(
    socket-path => '/run/cro-fcgi/my-cro-app.sock',
    application => MyCroApp
);
$service.start;

Webserver config (Apache here):

Listen 43210
<VirtualHost 127.0.0.1:43210>
    ProxyFCGIBackendType GENERIC
    ProxyPass "/" "unix:/run/cro-fcgi/my-cro-app.sock|fcgi://127.0.0.1/" enablereuse=on
</VirtualHost>

Description

This module provides a FastCGI frontend for Cro. It allows a simple coupling of a webserver and Cro application.

The module provides a drop-in replacement for Cro::HTTP::Server named Cro::FCGI::Server. It can be instantiated for either a network connetion or a Unix socket connection.

To start listening on a network port pass the host and port arguments.

To start listening on a Unix socket, pass the socket-path argument. Make sure the socket is readable and writable by the webserver process. Note that SELinux can possibly block access to the socket file for the webserver.

Server and client host and port

To access the remote and local host and port of the connection of a given request, use the .socket-host, .socket-port, .peer-host and .peer-port methods of the request object, not the equally named methods of the Cro::Connection object ($request.connection.*). With FCGI, the connection represents the connection to the webserver, not the client!

Limitations

Currently starting the application process automatically is not supported. You have to start the Cro application separately. For Apache this means you should use mod_proxy_fcgi instead of mod_fcgid.

AUTHOR

Patrick Böker [email protected]

License

This module is distributed under the terms of the Artistic License 2.0.

Cro::FCGI v1.0.0

FastCGI support for Cro

Authors

  • Patrick Böker

License

Artistic-2.0

Dependencies

Cro::Core:ver<0.8.9>Cro::HTTP:ver<0.8.9>

Test Dependencies

Provides

  • Cro::FCGI::ConnectionState
  • Cro::FCGI::GeneralParser
  • Cro::FCGI::NameValuePairs
  • Cro::FCGI::Record
  • Cro::FCGI::RecordParser
  • Cro::FCGI::RecordSerializer
  • Cro::FCGI::RequestParser
  • Cro::FCGI::ResponseSerializer
  • Cro::FCGI::Server

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.