Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

The value of a program is proportional to the weight of its output.


devel / comp.infosystems.gemini / Re: Programming CGI

SubjectAuthor
* Programming CGIMartin
`* Re: Programming CGIVlad Markov
 +- Re: Programming CGIGustaf Erikson
 +* Re: Programming CGInytpu
 |+- Re: Programming CGIMartin
 |`- Re: Programming CGIMartin
 `- Re: Programming CGIbunburya

1
Programming CGI

<std9kv$iit$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=122&group=comp.infosystems.gemini#122

  copy link   Newsgroups: comp.infosystems.gemini
Path: i2pn2.org!i2pn.org!aioe.org!MKiEn4kk3HXdcv3qnSpjNQ.user.46.165.242.75.POSTED!not-for-mail
From: martin@datapulp.de (Martin)
Newsgroups: comp.infosystems.gemini
Subject: Programming CGI
Date: Wed, 2 Feb 2022 07:51:10 +0100
Organization: Aioe.org NNTP Server
Message-ID: <std9kv$iit$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="19037"; posting-host="MKiEn4kk3HXdcv3qnSpjNQ.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.5.1
Content-Language: en-US
X-Notice: Filtered by postfilter v. 0.9.2
 by: Martin - Wed, 2 Feb 2022 06:51 UTC

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

Re: Programming CGI

<slrnsvp1gf.1fa.vlad@happy.dwarf7.net>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=126&group=comp.infosystems.gemini#126

  copy link   Newsgroups: comp.infosystems.gemini
Path: i2pn2.org!i2pn.org!aioe.org!eVyHPIzTgeXWPM3ahz5L6g.user.46.165.242.75.POSTED!not-for-mail
From: vlad@happy.dwarf7.net (Vlad Markov)
Newsgroups: comp.infosystems.gemini
Subject: Re: Programming CGI
Date: Fri, 4 Feb 2022 01:49:03 -0000 (UTC)
Organization: Aioe.org NNTP Server
Message-ID: <slrnsvp1gf.1fa.vlad@happy.dwarf7.net>
References: <std9kv$iit$1@gioia.aioe.org>
Injection-Info: gioia.aioe.org; logging-data="4182"; posting-host="eVyHPIzTgeXWPM3ahz5L6g.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: slrn/1.0.3 (FreeBSD)
X-Notice: Filtered by postfilter v. 0.9.2
 by: Vlad Markov - Fri, 4 Feb 2022 01:49 UTC

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

Re: Programming CGI

<8735kz591l.fsf@news.gerikson.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=129&group=comp.infosystems.gemini#129

  copy link   Newsgroups: comp.infosystems.gemini
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: gerikson@gmial.com (Gustaf Erikson)
Newsgroups: comp.infosystems.gemini
Subject: Re: Programming CGI
Date: Fri, 04 Feb 2022 09:29:42 +0100
Organization: A noiseless patient Spider
Lines: 20
Message-ID: <8735kz591l.fsf@news.gerikson.com>
References: <std9kv$iit$1@gioia.aioe.org>
<slrnsvp1gf.1fa.vlad@happy.dwarf7.net>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="c5d1151d6a8e893082be812a053422d1";
logging-data="29355"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Ined1Sx+yjqlHmKY70xgR/x2OXO5Lrco="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)
Cancel-Lock: sha1:p8IPLGKNBiBwZS5cD/GJTUPj2KI=
sha1:BD9l4gvLHBESFFq5R4ubtBwF0Ok=
 by: Gustaf Erikson - Fri, 4 Feb 2022 08:29 UTC

Vlad Markov <vlad@happy.dwarf7.net> writes:

> On 2022-02-02, Martin <martin@datapulp.de> wrote:
>>
> I use gemserv as my gemini server. The documentation was in the "README" file
> that came with it.
>
> ### CGI Environments
>
[snip]

I used gemserv too and played around a bit with cgi-bin. Here are some
examples using Perl's Template Toolkit:

https://github.com/gustafe/gemsite/blob/main/cgi-bin/fr.cgi

I've disabled CGI for the time being because I got spooked by security
concerns.

/g.

Re: Programming CGI

<stkfkm$mj4$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=132&group=comp.infosystems.gemini#132

  copy link   Newsgroups: comp.infosystems.gemini
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: alex@nytpu.com (nytpu)
Newsgroups: comp.infosystems.gemini
Subject: Re: Programming CGI
Date: Sat, 5 Feb 2022 00:16:22 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 5
Message-ID: <stkfkm$mj4$1@dont-email.me>
References: <std9kv$iit$1@gioia.aioe.org>
<slrnsvp1gf.1fa.vlad@happy.dwarf7.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 5 Feb 2022 00:16:22 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="55f218738bc37fb696145f794230dfc0";
logging-data="23140"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/M208Sih4CbOZ6JZSAVlFI"
User-Agent: Pan/0.149 (Bellevue; 62e3c58 /home/alex/aur/pan-git/pan)
Cancel-Lock: sha1:y35SzdkqVmjYIaLUOawf/qGOhcg=
 by: nytpu - Sat, 5 Feb 2022 00:16 UTC

Tomasino made a video a while back discussing common paradigms when
dealing with CGI and input too, which is helpful:
https://www.youtube.com/watch?v=9Anh0sNUCY4

~nytpu

Re: Programming CGI

<stmkm6$rs3$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=134&group=comp.infosystems.gemini#134

  copy link   Newsgroups: comp.infosystems.gemini
Path: i2pn2.org!i2pn.org!aioe.org!6f3slq5+hqxbWegUd9AO7g.user.46.165.242.75.POSTED!not-for-mail
From: martin@datapulp.de (Martin)
Newsgroups: comp.infosystems.gemini
Subject: Re: Programming CGI
Date: Sat, 5 Feb 2022 20:54:43 +0100
Organization: Aioe.org NNTP Server
Message-ID: <stmkm6$rs3$1@gioia.aioe.org>
References: <std9kv$iit$1@gioia.aioe.org>
<slrnsvp1gf.1fa.vlad@happy.dwarf7.net> <stkfkm$mj4$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="28547"; posting-host="6f3slq5+hqxbWegUd9AO7g.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.5.1
Content-Language: en-US
X-Notice: Filtered by postfilter v. 0.9.2
 by: Martin - Sat, 5 Feb 2022 19:54 UTC

Am 05.02.22 um 01:16 schrieb nytpu:
> Tomasino made a video a while back discussing common paradigms when
> dealing with CGI and input too, which is helpful:
> https://www.youtube.com/watch?v=9Anh0sNUCY4
>
> ~nytpu

Many thanks, this is exactly the information I needed. Currently I had
success to some degree with a self made python program. But up to now I
never coded in python, I never coded CGI and I never coded a Gemini app :-D

I also added this to the technical documentation sub-page of my German
language capsule/website:

https://was-ist-gemini.de/technische-gemini-dokumentation.html

gemini://was-ist-gemini.de/technische-gemini-dokumentation.gmi

Great video! I never thought that handling client certificates on the
CGI side would be so easy.

Martin

Re: Programming CGI

<stp4qv$e6f$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=136&group=comp.infosystems.gemini#136

  copy link   Newsgroups: comp.infosystems.gemini
Path: i2pn2.org!i2pn.org!aioe.org!0QMmHM9tWwTf0fYbkqOXjA.user.46.165.242.75.POSTED!not-for-mail
From: martin@datapulp.de (Martin)
Newsgroups: comp.infosystems.gemini
Subject: Re: Programming CGI
Date: Sun, 6 Feb 2022 19:42:36 +0100
Organization: Aioe.org NNTP Server
Message-ID: <stp4qv$e6f$1@gioia.aioe.org>
References: <std9kv$iit$1@gioia.aioe.org>
<slrnsvp1gf.1fa.vlad@happy.dwarf7.net> <stkfkm$mj4$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="14543"; posting-host="0QMmHM9tWwTf0fYbkqOXjA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.5.1
Content-Language: en-US
X-Notice: Filtered by postfilter v. 0.9.2
 by: Martin - Sun, 6 Feb 2022 18:42 UTC

Am 05.02.22 um 01:16 schrieb nytpu:
> Tomasino made a video a while back discussing common paradigms when
> dealing with CGI and input too, which is helpful:
> https://www.youtube.com/watch?v=9Anh0sNUCY4
>
> ~nytpu

I extended the two shell CGI examples provided in the video of Tomasino
a bit and made them self-documented:

gemini://hubbz.de/apps/tls-test
gemini://hubbz.de/apps/input-test

Just in case that somebody other wants to learn about CGI programming too...

Next step for me would be to try out TLS authentication together with
storing some data in a database, sqlite at first. Seems to be easy on
the first view...

Martin

Re: Programming CGI

<stp73g$1h5h$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=137&group=comp.infosystems.gemini#137

  copy link   Newsgroups: comp.infosystems.gemini
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.mixmin.net!aioe.org!6VA5CMh1oTC1UjxJVMibGA.user.46.165.242.75.POSTED!not-for-mail
From: bunburya@tilde.club (bunburya)
Newsgroups: comp.infosystems.gemini
Subject: Re: Programming CGI
Date: Sun, 6 Feb 2022 19:21:20 +0000
Organization: Aioe.org NNTP Server
Message-ID: <stp73g$1h5h$1@gioia.aioe.org>
References: <std9kv$iit$1@gioia.aioe.org>
<slrnsvp1gf.1fa.vlad@happy.dwarf7.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="50353"; posting-host="6VA5CMh1oTC1UjxJVMibGA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.5.1
Content-Language: en-US
X-Notice: Filtered by postfilter v. 0.9.2
 by: bunburya - Sun, 6 Feb 2022 19:21 UTC

In case people are also interested in exploring SCGI (apparently not
supported by gmid, but supported by other popular servers like gemserv
and Molly Brown), I wrote a gemlog post a while ago on how to write and
deploy an SCGI script using Python:

gemini://gemini.bunburya.eu/gemlog/posts/2021-04-07-dynamic-content-scgi-gemini.gmi

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor