๐พ Archived View for bbs.geminispace.org โบ s โบ Gemini โบ 15811 captured on 2024-05-26 at 15:08:44. Gemini links have been rewritten to link to archived content
โฌ ๏ธ Previous capture (2024-05-12)
โก๏ธ Next capture (2024-06-16)
-=-=-=-=-=-=-
CGI: I am interested in CGI tutorials for Gemini applications. I have basic knowledge but need some best practice tutorials. maybe to get more insights on common pitfalls. would be very interested in getting some hints. thankx
Mar 26 ยท 2 months ago
๐ mifuyne ยท Mar 27 at 00:43:
Maybe you'll find this useful? It does have a couple of examples: a really basic hello world script, and a version of it that requests user input.
โ https://tilde.team/wiki/gemini-cgi
There are other cgi powered capsules that have their source code available for perusal. The one I know off the top of my head is Astrobotany:
Hope that helps some!
๐ stack ยท Mar 27 at 02:57:
First, get an account with CGI privileges. There is not much to CGI: your script is invoked with a few environment variables set. You can read them, then generate a gemini-legal response. For instance, this script will dump the environment for your perusal:
โ stack.tilde.cafe/cgi-bin/env.sh
The script executed is:
#!/bin/sh printf "20 text/gemini\r\n" printenv
๐ stack ยท Mar 27 at 03:00:
Sorry, the correct URL for the env.sh script is:
โ tilde.cafe/~stack/cgi_bin/env.sh
๐ stack ยท Mar 27 at 03:05:
If you hit that script with a client certificate attached, you will see the certificate info as well! That is how you can track sessions or whatever.
๐ mifuyne ยท Mar 27 at 03:53:
That's neat! Thanks for this ๐ I've been pondering making a CGI script too so being able to peek behind the curtains like this helps.
๐ gritty ยท Mar 27 at 23:57:
i have some examples on my HOWTO
๐ satch ยท Mar 28 at 02:19:
See the Skylab misfin client source for a pretty complex CGI gemini application:
๐ mimas2AC [OP] ยท Mar 28 at 14:02:
Thanks for the tip to look around on GitHub, Sourcehut or similar for Gemini CGI scripts applications. I didn't have that on my screen. Thanks for that
๐ stack ยท Mar 28 at 17:01:
The main differences between Gemini and http cgis are:
Keeping that in mind, any cgi tutorial is useful (not just gemini)
๐ง pytat0 ยท Apr 17 at 11:33: