add SCGI compliance docs

Signed-off-by: kim (grufwub) <grufwub@gmail.com>
development
kim (grufwub) 4 years ago
parent c1c15b4266
commit 6e6115ae54

@ -39,6 +39,8 @@ WARNING: the (currently non-extant) development branch is filled with lava,
[CGI compliance](docs/CGI.md)
[SCGI compliance](docs/SCGI.md)
[Gopher specific information](docs/GOPHER.md)
[Extra notes](docs/MISC.md)

@ -78,8 +78,6 @@ func generateCGIEnv(client *Client, request *Request) []string {
func generateSCGIEnv(client *Client, request *Request) []*envVar {
env := append(scgiEnv, newEnvVar("REMOTE_ADDR", client.IP()))
env = append(env, newEnvVar("QUERY_STRING", request.Params()))
env = append(env, newEnvVar("SCRIPT_NAME", request.Path().Relative()))
env = append(env, newEnvVar("SCRIPT_FILENAME", request.Path().Absolute()))
env = append(env, newEnvVar("REQUEST_URI", request.Path().Selector()))
return env
}

@ -0,0 +1,24 @@
# SCGI Compliance
The list of environment variables sent are as follows:
```
# Set
SCGI
SERVER_SOFTWARE
SERVER_PROTOCOL
SERVER_NAME
SERVER_PORT
REMOTE_ADDR
QUERY_STRING
DOCUMENT_ROOT
REQUEST_URI
# NOT set
Env Var | Reasoning
----------------------------------------------
CONTENT_LENGTH | We always make the equivalent of HTTP GET requests, so
| content length will always be 0. This is a very HTTP-centric
| variable which we do not support.
[...] | (See skipped CGI variables under CGI compliance doc).
```

@ -90,6 +90,29 @@ e.g. scripts within cgi-bin to the root directory:
Entries are parsed, compiled, and so matched-against in order. They are matched against
relative paths so please bear this in mind if you have user directories enabled.
# SCGI Request Mapping Regex
Request mapping is parsed as a new-line separated list of remap statements of form:
`/regex/matched/against -> /var/run/gopher_scgi.sock`
Internally, the request remapping statements are parsed as (shown as Python code):
`/match_statement -> /template_statement.sock`
```Python
# Where the match statement is compiled using
regex = "(?m)" + "/match_statement".removeprefix("/") + "$"
# And the template is stored as
template = "/template_statement.sock"
```
e.g. everything under scgi to the SCGI socket:
`/scgi/(?P<uri>[^/]+) -> /var/run/gopher_scgi.sock`
# User server spaces
When user server spaces are enabled, they are accessed via the following gopher URL:

Loading…
Cancel
Save