๐Ÿ’พ Archived View for bbs.geminispace.org โ€บ u โ€บ stack โ€บ 17032 captured on 2024-06-16 at 14:56:07. Gemini links have been rewritten to link to archived content

View Raw

More Information

โฌ…๏ธ Previous capture (2024-05-26)

โžก๏ธ Next capture (2024-07-09)

๐Ÿšง View Differences

-=-=-=-=-=-=-

Got CGISESH working. Simple demo.

tilde.cafe/~stack/cgisesh/live/cgitest

Click on the link; the cgi will keep track of how many times you visit (refresh to see the counter go up). If my cgisesh server is running, of course.

This simple cgi uses cgisesh to keep session information for each user (visit count in this simple example). cgisesh is a minimal in-memory key-value server designed to provide per-user session data for Gemini CGI scripts.

There is still some work to do, but as a first round it's not bad. It makes it trivial to keep session state for games.

https://tildegit.org/stack/cgisesh

Here is the source, BSD 3-clause license.

I will work on error-proofing and probably some optimizations (right now it's just a linear search, although in memory and with tens or hundreds of unique users is probably faster than databases...)

The interface is dead simple:

void cgisesh_init(int RecSize,char* SocketPath);
int  cgisesh_lookup(char* sha256, void*buf);
int  cgisesh_update(void*buf);

My original announcement with project details and rationale

gemini://bbs.geminispace.org/u/stack/17006

๐Ÿš€ stack

May 17 ยท 4 weeks ago ยท ๐Ÿ‘ skyjake, corscada

4 Comments โ†“

๐Ÿ€ gritty ยท May 17 at 18:01:

it shows my hash but I get an error: 111

๐Ÿš€ stack [OP] ยท May 17 at 19:13:

@gritty, the server is not up at the moment. The hash is just from the CGI...

๐Ÿš€ stack [OP] ยท May 17 at 19:20:

@gritty: back up... I started 'server' from an ssh command line and it was killed when my session disconnected. It's just a toy for now, obviously it needs to run as a daemon, or at least in a tmux session!

๐Ÿ€ gritty ยท May 19 at 01:52:

I don't know much about SCGI but what I read is that one server is started for all incoming requests and uses sockets. I know molly brown supports it.

do you think an SCGI server could hold sessions in memory like this?