💾 Archived View for gemi.dev › gemini-mailing-list › 000012.gmi captured on 2023-12-28 at 15:39:40. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-11-04)
-=-=-=-=-=-=-
To get away from the text formatting argument (which I think comprises over half the messages so far) I thought I might ask for some guidelines as to the best practice for Gemini servers. I came up with these as I was reworking my Gemini server (getting ready to release it, as I've had one person already request a copy). So here we go: I have this bit of code to check the request: if loc.scheme ~= 'gemini' or loc.host ~= CONF.network.host or loc.port ~= CONF.network.port then log(ios,59,"",reply(ios,"59\t",MSG[59],"\r\n")) ios:close() return end I'm currently returning a "Bad Request" for this, if the protocol, host and port don't match what is currently configured on my server. The other possible status is "Proxy Request Refused". My server doesn't do proxy requests. What should the proper status code be? Is "Bad Request" fine here? Next. Each request is run through a series of checks to see if a resource has moved or is gone: redirect = { permanent = { ... } -- list of permenent redirects temporary = { ... } -- list of tempoarary redirects gone = { ... } -- list of gone items } For any given list, it's checked in the order presented, but the ordering of the major sections is currently defined as: temporary, permanent then gone. I keep going back and forth if this shouldn't be: gone, permanent, temporary or even if it matters. Next. The actual order of things is: read request check redirects check authorization check handlers Each of the checks consist of the path matched against a pattern, and the first match wins. So for instance (the path fields, for instance, are Lua patterns---think regex): redirect = { permanent = { { '^/source%-code