!/bin/sh

set -e

printf "20 text/plain; lang=en\r\n"

cat <<EOF

           The Common Gateway Interface for Gemini

It really seems that the Common Gateway Interface (CGI, RFC-3875)

can be adapted for the Gemini protocol easily!

This is a test page for the CGI implementation in gmid[0], a small

and secure Gemini server. When in doubt, I'm trying to follow the

GLV-1.12556[1] behaviour. Sean Conner provides a similar page at [2].

                  CGI Environment Variables

means "not set".

EOF

echo GATEWAY_INTERFACE=$GATEWAY_INTERFACE

echo GEMINI_DOCUMENT_ROOT=$GEMINI_DOCUMENT_ROOT

echo GEMINI_SCRIPT_FILENAME=$GEMINI_SCRIPT_FILENAME

echo GEMINI_URL=$GEMINI_URL

echo GEMINI_URL_PATH=$GEMINI_URL_PATH

echo PWD=$PWD

echo PATH_INFO=${PATH_INFO:-""}

echo PATH_TRANSLATED=${PATH_TRANSLATED:-""}

echo QUERY_STRING=$QUERY_STRING

echo REMOTE_ADDR=$REMOTE_ADDR

echo REMOTE_HOST=$REMOTE_HOST

echo REQUEST_METHOD=$REQUEST_METHOD

echo SCRIPT_NAME=$SCRIPT_NAME

echo SERVER_NAME=$SERVER_NAME

echo SERVER_PORT=$SERVER_PORT

echo SERVER_PROTOCOL=$SERVER_PROTOCOL

echo SERVER_SOFTWARE=$SERVER_SOFTWARE

echo AUTH_TYPE=$AUTH_TYPE

echo REMOTE_USER=$REMOTE_USER

echo TLS_CLIENT_ISSUER=$TLS_CLIENT_ISSUER

echo TLS_CLIENT_HASH=$TLS_CLIENT_HASH

echo TLS_VERSION=$TLS_VERSION

echo TLS_CIPHER=$TLS_CIPHER

echo TLS_CIPHER_STRENGTH=$TLS_CIPHER_STRENGTH

echo TLS_CLIENT_NOT_AFTER=$TLS_CLIENT_NOT_AFTER

echo TLS_CLIENT_NOT_BEFORE=$TLS_CLIENT_NOT_BEFORE

echo

echo

echo " CGI Argument List"

echo

echo "- $0"

for i in "$@"; do

echo "- $i"

done

cat <<EOF

                            notes

EOF

Proxy Information
Original URL
gemini://gemini.omarpolo.com/cgi/env
Status Code
Success (20)
Meta
application/octet-stream
Capsule Response Time
488.868485 milliseconds
Gemini-to-HTML Time
1.939395 milliseconds

This content has been proxied by September (ba2dc).