๐พ Archived View for bbs.geminispace.org โบ u โบ stack โบ 17032 captured on 2024-07-09 at 04:13:33. Gemini links have been rewritten to link to archived content
โฌ ๏ธ Previous capture (2024-06-16)
โก๏ธ Next capture (2024-08-18)
-=-=-=-=-=-=-
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
May 17 ยท 8 weeks ago ยท ๐ skyjake, corscada
๐ 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?