On 9/10/26 12:15 PM, Joe Orton wrote:
> 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?

I would be in favor of a fresh start. At least in the beginning this
should ease choosing between the two.

How do we deal with OSes (e.g. probably Solaris and AIX) where it is not part of
the standard setup?
Just another external dependency?
Or do we want to keep offering the current mod_mime_magic there longterm?

Regards

RĂ¼diger

Reply via email to