3.1.3 Differences under CGI/FastCGI

Whereas the StandAlone coupler builds Request objects directly from the raw request coming off the wire, the CGI and FastCGI couplers must resort to reconstructing Requests from the environment and standard input. The resulting object has the same API as above, but since some attributes could have subtly different meanings, we provide the following reference. Where called for, \r\n line breaks are used.

raw
The concatenation of raw_line, raw_headers, and raw_body as described below.

raw_line
The Request-URI is reconstructed from the SCRIPT_NAME, PATH_INFO, and QUERY_STRING environment variables. This is combined with the REQUEST_METHOD and SERVER_PROTOCOL variables to approximate the Request-Line.

raw_headers
The headers are reconstructed by taking all environment variables beginning with "HTTP_" and replacing all underscores with dashes.

raw_body
Read from the standard input.

method
Equivalent to the REQUEST_METHOD environment variable.

uri
The dictionary is based on raw_line as derived above.

path
Equivalent to the PATH_INFO environment variable.

headers
The Message object is constructed from raw_headers as described above.

See Also:

The CGI Specification
The reference for CGI, including use of environment variables and standard input.
httpy is Zeta software. It is copyright © 2006 by Chad Whitacre, and is offered free of charge, warranty, and restrictions.