Good practices regarding MIME type
Sean Conner
sean at conman.org
Thu Dec 10 22:06:19 GMT 2020
It was thus said that the Great Solène Rapenne once stated:
> Hi,
>
> I wrote a gemini server in C and I currently use an hardcoded list of
> file extensions <-> MIME type assocation.
> This isn't great because it relies on file extension which can be wrong,
> but a file without extension would
> use a default.
>
> I chose to set a default text/gemini in case the extension is unknown or
> if the file has no extension.
>
> What are the good practices to determine a file MIME type?
For my server [1] you can configure a mapping of extensions to MIME type.
If a file's extension isn't found in that mapping, then I use libmagic to
determine the MIME type.
-spc
[1] https://github.com/spc476/GLV-1.12556
More information about the Gemini
mailing list