[spec] adding a "magic number" for gemini files
Sean Conner
sean at conman.org
Sun Dec 27 22:18:08 GMT 2020
It was thus said that the Great cage once stated:
> On Sat, Dec 26, 2020 at 06:25:43PM -0500, Sean Conner wrote:
>
> [...]
>
> > > I was thinking abo[u]t file(1) and libmagic in general.
> >
> > I use libmagic for my server [1] and yet, I still use an extension to mark
> > a Gemini text file.
>
> Do you mean you check the file extension for recognize a gemini file?
> Or you use same kind of heuristic to prevent libmagic to returns
> gemini file as text?
In the configuration file, the user can specify a mapping of extensions to
MIME type, to which the default extension type that identifies a Gemini
index file is added (which for my server is ".gemini" but that can be
changed).
During a request, the extension is checked against this mapping. If (for
a non-Gemini file) this doesn't exist, only then is libmagic queried.
-spc
More information about the Gemini
mailing list