Do we have to repeat the softmagic call if checkzmagic resolves to x-gzip/x-deflate and the internal content type needs to be deciphered?
If so, a tweak to this patch sounds like a winner, and could selectively recognize different inflation streams including bzip2 etc. On Fri, Jan 8, 2016 at 10:57 AM, Yann Ylavic <[email protected]> wrote: > On Fri, Jan 8, 2016 at 5:30 PM, Yann Ylavic <[email protected]> wrote: > > On Fri, Jan 8, 2016 at 3:17 PM, William A Rowe Jr <[email protected]> > wrote: > >> > >> Agreed it is configuration, but cant we simply tweak our recommended > >> conf/magic > >> file??? > >> > >> # standard unix compress > >> # Enable the alternate line below to present gzip content as a transfer > >> encoded > >> # stream of the underlying content; > >> #0 string \037\235 application/octet-stream > >> x-compress > >> 0 string \037\235 application/octet-stream > >> > >> # gzip (GNU zip, not to be confused with [Info-ZIP/PKWARE] zip archiver) > >> # Enable the alternate line below to present gzip content as a transfer > >> encoded > >> # stream of the underlying content; > >> #0 string \037\213 application/octet-stream > >> x-gzip > >> 0 string \037\213 application/octet-stream > >> > >> WDYT? > > > > I wasn't aware of conf/magic file, but it seems not used by zmagic() > > which hardcodes its types. > > I may be missing something though... > > Looks like it is already like this in conf/magic of 2.4.x and 2.2.x. > My bet is that zmagic() is run before softmagic(), so the magic file > is of no help. > > Maybe a simpler patch could be: > > Index: modules/metadata/mod_mime_magic.c > =================================================================== > --- modules/metadata/mod_mime_magic.c (revision 1723283) > +++ modules/metadata/mod_mime_magic.c (working copy) > @@ -880,14 +885,6 @@ static int tryit(request_rec *r, unsigned char *bu > int checkzmagic) > { > /* > - * Try compression stuff > - */ > - if (checkzmagic == 1) { > - if (zmagic(r, buf, nb) == 1) > - return OK; > - } > - > - /* > * try tests in /etc/magic (or surrogate magic file) > */ > if (softmagic(r, buf, nb) == 1) > @@ -900,6 +897,14 @@ static int tryit(request_rec *r, unsigned char *bu > return OK; > > /* > + * Try compression stuff > + */ > + if (checkzmagic == 1) { > + if (zmagic(r, buf, nb) == 1) > + return OK; > + } > + > + /* > * abandon hope, all ye who remain here > */ > return DECLINED; > -- >
