Simple Common Gateway Interface (SCGI)
Created on 2021-01-30T17:23:13-06:00
Encoding
- Headers and values are terminated with NULL (00.)
- All keys and values are concatenated together.
- This bundle is encoded as a netstring.
Rules:
- The first header/value pair must be CONTENT_LENGTH.
- The value of CONTENT_LENGTH is written in decimal.
- A header/value pair of SCGI and 1 must be present.
- The same key cannot be present more than once.
Example
Content-Type: application/x-blobcat Content-Length: 6 Henlo.
First the headers are flattened:
CONTENT_LENGTH <00> 6 <00> CONTENT-TYPE <00> application/x-blobcat <00>
Then wrapped in a netstring:
68:CONTENT_LENGTH<00>6<00>CONTENT-TYPE<00>application/x-blobcat<00>,
And the content of the message follows:
68:CONTENT_LENGTH<00>6<00>CONTENT-TYPE<00>application/x-blobcat<00>, Henlo.
Response
An SCGI client sends the raw response including HTTP or Gemini headers and closes the socket.