Hannu Hartikainen e0e426694b Add CGI env parameter PATH_INFO
This means that a CGI script, say, /cgi-bin/foo can be requested using a
subpath like /cgi-bin/foo/bar/baz. In that case, PATH_INFO is set to
"/bar/baz". As it is easy to compute SCRIPT_NAME along with PATH_INFO,
we also refactor it. SCRIPT_NAME now contains the URL to the script, not
just the basename of it. This is typical CGI behavior.

Since the cgi handling code was needed in two places, it was refactored
a bit. Other parts of handle_connection could be refactored similarly.

The code now supports executables inside subdirectories of cgipath.
Previously the executable had to be in cgipath, subdirs not allowed.
2020-07-05 14:09:28 -04:00
2020-05-26 17:31:28 -04:00
2020-05-28 15:25:12 -04:00
2020-07-05 14:09:28 -04:00
2020-05-13 21:42:00 -04:00
2020-06-08 00:05:45 -04:00
2020-06-08 00:05:45 -04:00
2020-04-28 18:49:34 -04:00
2020-06-08 00:05:45 -04:00

# Gemserv

A gemini server written in rust.

## Features

 - Vhosts
 - CGI
 - User directories
 - Reverse proxy
 - Redirect
 - SCGI

## Installation and running

OpenSSL 1.1.0g or LibreSSL 2.7.0 or newer is required.

 - Clone the repo
 - If you want to use all features run 'cargo build --release' or if you only
   want to serve static files run 'cargo build --release --no-default-features'
 - Modify the config.toml to your needs
 - Run './target/release/gemserv config.toml'

### Init scripts

In the init-scripts directory there's OpenRC(Courtesy of Tastytea) and systemd
service files.

### NetBSD
If running on NetBSD you'll need to set the environmental variable OPENSSL_DIR
before compiling.

'export OPENSSL_DIR="/usr/pkg"'

Also to run you'll need to symlink libssl, and libcrypt to "/usr/lib" by
running:

'ln -s /usr/pkg/lib/libssl.so.1.1 /usr/lib'
'ln -s /usr/pkg/lib/libcrypt.so.1.1 /usr/lib'

Thanks to tiwesdaeg for figuring it out.

## CGI and SCGI

There's example SCGI scripts for python and perl in the cgi-scripts directory.

In the configuration file there's "cgi" which is an optional bool to turn cgi
on. If it's true it'll run scripts from any directory. To limit it to only one
directory set "cgipath"

If "cgi" is false or not set the server will respond "Not Found" to any
executable file.

Scripts have 5 seconds to complete or they will be terminated.

### CGI Environments


These variables are preset for you. If you need more you can define them in the
config file under "cgienv"

 - GEMINI_URL
 - SERVER_NAME
 - SERVER_PROTOCOL
 - SERVER_SOFTWARE
 - SCRIPT_NAME
 - REMOTE_ADDR
 - REMOTE_HOST
 - REMOTE_PORT
 - QUERY_STRING
Description
Miroir de https://git.sr.ht/~int80h/gemserv avec les modifications propres à Ti Nuage.
https://git.sr.ht/~int80h/gemserv
Readme 159 KiB
Languages
Rust 95.9%
Python 1.4%
Dockerfile 1%
Perl 0.9%
Shell 0.8%