Re: Programming CGI
Message headers
From: Vlad Markov <vlad@happy.dwarf7.net>
Subject: Re: Programming CGI
Date: Fri, 4 Feb 2022 01:49:03 -0000 (UTC)
Message-ID: <slrnsvp1gf.1fa.vlad@happy.dwarf7.net>
Message content
On 2022-02-02, Martin <martin@datapulp.de> wrote:
>
Hi. I recently thought about trying out some CGI on gmid from omar polo.
Do you have some pointers for some very basic examples for me to
understand, how it works? Are there variables specific to Gemini? Is
there a preferred subset that is know to work on must supporting servers?
>
Ciao
Martin
I use gemserv as my gemini server. The documentation was in the "README" file
that came with it.
## 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
- PATH_INFO
TLS variables
- AUTH_TYPE
- TLS_CLIENT_HASH
- REMOTE_USER
A simple script. The user types in something and it is echoes back:
!/usr/bin/perl
$buffer = $ENV{'QUERY_STRING'};
if (defined $buffer ){
print "20 text/gemini; charset=utf-8 \r\n";
print "#CGI page \r\n";
print "Your name is $buffer \r\n";
} else {
print "10 What is your name \r\n";
}
enjoy
Related
Parent:
Children: