Comment by ๐ธ bluesman
Re: "I accidentally wrote a Gemini server"
I get a download dialog in Alhena because the 20 response has two spaces before the mime type. I see it works in Lagrange so maybe that's legal and I should trim(). FWIW since I haven't encountered that before.
2025-09-12 ยท 8 months ago
15 Later Comments โ
๐ ingrix ยท 2025-09-12 at 03:47:
@stack This looks great, I kicked its tires briefly and it didn't do anything weird. Nicely done, can't wait to see the code! One thing to add would be timeouts to the connections or you set yourself up for an easy DOS.
@bluesman it looks like the specification is for a single space.
From the "Responses" section
But, I think trimming is still a good idea because of situations like this - I wasn't quite sure of whether two spaces was compliant or not before digging into the spec just now.
๐ skyjake [mod...] ยท 2025-09-12 at 05:02:
@bluesman Lagrange does indeed trim the start of the media type. I would say that's a bug because the trimming really only makes sense for the human-readable error messages (not statuses 10, 11, 20, 30, 31). I'll patch this.
The result here will be that the media type becomes the unrecognized " text/gemini" but Lagrange will check for valid UTF-8 and display the contents as autodetected text with a warning banner.
โ๏ธ gim ยท 2025-09-12 at 08:08:
Constantly getting connection refused
๐ stack [OP] ยท 2025-09-12 at 11:19:
@gim, something causes a double free in OpenSSL (because I do no malloc or free), and I have to track it down.
I will get rid of that space in the request as well.
๐พ fab ยท 2025-09-12 at 11:22:
I get a connection error with Telescope Browser: "Can't parse IRI".
*EDIT*
Works on Lagrange. Maybe Telescope browser is a little to restrictive concerning the specs.
๐ mbays ยท 2025-09-12 at 11:45:
Nice. Works fine for me (in diohsc), though I get what looks like a buggy error message on requesting a non-existent file: "50 no can do i" (missing a 't'?). That happens in particular at /, I guess you'll want to serve index.gmi there.
๐ mbays ยท 2025-09-12 at 11:48:
By the way, if you want to optimise things further, you might consider implementing RTT0 ("early data") mode (while being careful to handle replay attacks; iirc that just means that you shouldn't accept the same ticket twice).
๐ stack [OP] ยท 2025-09-12 at 13:15:
The message is correctly idiomatic with a subtle reference to Hall and Oats.
Also, current not configured to serve directories.
๐ ingrix ยท 2025-09-12 at 18:27:
@stack fyi as of Fri Sep 12 06:24:12 PM UTC 2025 I get a hang when trying to access spell.ddns.net:10965/index.gmi with my pxc client and Lagrange. With pxc I can see the header 20 text/gemini but then the connection just stays open. For fuzzing the OpenSSL issue you could consider trying to pipe random data to it with /dev/urandom - that has been a good stress test for me in the past.
๐ stack [OP] ยท 2025-09-12 at 19:08:
@ingrix, I've been actively whumping on it so you probably caught it in-between updates or during a few minutes I had it down.
I integrated timeouts, fixed a couple of deadlock issues, and I think it is kind of working.
Do you have a script for stress-testing the server?
๐ ingrix ยท 2025-09-12 at 20:08:
@stack if I were smart I probably would, but right now I just hammer on things by hand. I'll start putting some stuff into a script. My tire-kicking last night involved connecting via nc and sending some random data, feeding it misformatted urls, sending it properly formatted urls, directory traversal attempts, etc. I'll hammer on it some more and post the script somewhere.
๐ฝ spc476 ยท 2025-09-13 at 09:11:
Don't worry, the bots will find it eventually and then the fun really starts.
๐ stack [OP] ยท 2025-09-13 at 12:42:
Discussion moving to its own thread for the Fornax server
โ bbs.geminispace.org/s/Fornax
๐ฆ bsj38381 ยท 2025-09-28 at 23:57:
It's working pretty smoothly on Lagrange desktop.
๐ท baran ยท 2025-09-29 at 09:59:
I hit it now. He tells me:
Hello. You probably want
Original Post
I accidentally wrote a Gemini server โ For more info and to help me test it, please hit it now: [gemini link] I will let you know how it goes. Reasonably complete as proof of concept. Discussion moving to [gemini link]