CGI

Hello all,

I was excited to learn about Gemini recently. I ported some web content of
mine over (gemini://pboyd.io), and I've been enjoying looking through
what's out there.

The Gemini sites (err.. capsules?) remind me of the web in another era, so
I thought it would be fun to re-create some "classic" CGI scripts. I
started with a Guestbook (gemini://pboyd.io/guestbook/, source: gemini://
pboyd.io/guestbook/guestbook.pl). I got it working, but it felt like I was
in the weeds from the very start.

The first problem I hit is that I'm limited to one input at a time. I
wanted a few inputs (name, location, comment). Of course, plenty of command
line programs work fine with a single argument list, so, in theory, that
should be enough. But flags or comma-separated input wasn't what I was
going for. Successive input prompts didn't seem quite right either.

I ended up with a "form" made out of links to input URLs. The data is
collected in a temp file named with a random session ID, and there's a
final "submit" link that updates the generated guestbook (in true retro CGI
fashion it probably fails horribly when two people submit at once).

This works, but like I said, kinda in the weeds. Is there a better way to
get multiple inputs that I missed?

The other problem I ran into is that dynamic responses were cached in my
client. In my case, the user would submit the form and be presented with an
error page. They'd fix the error and resubmit only to get the same error
again because of the client cache.

I worked around that by making sure each generated link is unique (by a
counter). Conditional GET behavior is probably too complicated, but it
would be nice if there were a "Pragma: no-cache" type flag on dynamic pages.

Anyway, am I making this harder than it needs to be? Am I just trying to do
something that shouldn't be done on Gemini?

Cheers,
Paul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.orbitalfox.eu/archives/gemini/attachments/20200717/c6a6
09a0/attachment.htm>

---

Next in thread (2 of 16): 🗣️ colecmac (a) protonmail.com (colecmac (a) protonmail.com)

View entire thread.