Crate fastcgi
fastcgi only.Expand description
FastCGI support for Rama.
§FastCGI
FastCGI is a binary protocol for interfacing interactive programs with a web server. It is a successor to CGI that avoids the overhead of spawning a new process for every request by keeping the application process alive and reusing it across many requests over a persistent connection.
The full specification is embedded in this crate at
specifications/fastcgi_spec.txt.
§Server
Use FastCgiServer to accept FastCGI connections (typically from nginx or
Apache acting as the web server front-end). It handles the protocol framing and
dispatches each assembled request to your inner rama_core::Service.
The inner service receives a FastCgiRequest containing the CGI environment
variables (params) and the request body (stdin), and must return a
FastCgiResponse whose stdout bytes are sent back as the CGI response.
§Client
Use FastCgiClient to connect to a FastCGI backend application (e.g. PHP-FPM).
It sends a FastCgiClientRequest (params + stdin) and returns a
FastCgiClientResponse containing the raw stdout bytes from the application.
This is the piece a reverse proxy uses: it accepts HTTP, constructs CGI environment variables, and calls the FastCGI backend via the client.
§Protocol building blocks
The proto module exposes all protocol types and codec primitives if you need
lower-level control:
proto::RecordHeader— the 8-byte header shared by every record.proto::BeginRequestBody/proto::EndRequestBody— fixed-length record bodies.proto::params— FastCGI name-value pair encoding and decoding.
§Rama
Crate used by the end-user rama crate and rama crate authors alike.
Learn more about rama:
- Github: https://github.com/plabayo/rama
- Book: https://ramaproxy.org/book/
Modules§
- body
- Streaming body type for FastCGI requests and responses.
- client
- FastCGI client implementation for Rama.
- http
http - HTTP adaptive layers for FastCGI.
- proto
- Implementation of the FastCGI Protocol.
- server
- FastCGI server implementation for Rama.
Structs§
- Client
Error - Error returned by FastCGI client framing operations.
- Client
Options - Configuration for
FastCgiClientandsend_on. - Fast
CgiBody - A streaming body for FastCGI requests and responses.
- Fast
CgiClient - FastCGI client that wraps an inner connector service.
- Fast
CgiClient Request - A FastCGI client request to send to a backend application server.
- Fast
CgiClient Response - The raw bytes received from a FastCGI application.
- Fast
CgiHttp Client - HTTP-to-FastCGI client.
- Fast
CgiHttp Client Connector - A connector that translates HTTP requests into FastCGI connections.
- Fast
CgiHttp Env - Per-request override of selected CGI environment variables.
- Fast
CgiHttp Service - A FastCGI application service that wraps an inner HTTP service.
- Fast
CgiRequest - A complete FastCGI request received from a web server.
- Fast
CgiResponse - A FastCGI response to be sent back to the web server.
- Fast
CgiServer - FastCGI server that accepts connections and dispatches requests to an inner service.
- Fast
CgiTcp Connector - Open a TCP connection to a FastCGI backend (typically php-fpm at
127.0.0.1:9000). - Fast
CgiUnix Connector - Open a Unix-socket connection to a FastCGI backend (typically php-fpm at
e.g.
/run/php/php8.3-fpm.sock). - Server
Options - Configuration for
FastCgiServer.