The magic file parsing code in mod_mime_magic is 30 years old and hasn't been maintained much in that time. The code has the same heritage as the "file" package widely available on Linux and BSD systems [1], which is actively maintained and exposes it via a "libmagic" API. It is quite simple to rebuild mod_mime_magic around that API - proof of concept here: https://github.com/apache/httpd/pull/752
There is a performance trade-off: the old code parses the text-format magic file at startup, the new code will mmap() the pre-compiled binary magic file per request. I don't see this as a big deal, if you are dependent on mod_mime_magic that's a fallback option anyway. In that PR I've added a mod_mime_libmagic based on the library - 335 lines vs the 2.5K lines of mod_mime_magic. An alternative would be to make most of mod_mime_magic #ifdef'ed out and embed the API use there directly? Kind of prefer starting fresh, any other opinions or objections to doing this? Regards, Joe [1] https://www.darwinsys.com/file/
