Hi Nick,

Nick Holland wrote on Sun, Apr 19, 2015 at 11:45:56AM -0400:

> I fear this is a stupid question, I suspect there's something I'm
> missing...
> 
> I have a web server.  Some files are binary, some are text.  Problem is,
> few have an "extension".  For purpose of example, the OpenBSD file sets
> show the problem very nicely:
> 
> INSTALL.i386  (text.  Solvable, list out .i386, .sparc, etc ...)
> SHA256                (text)
> SHA256.sig    (text.  Easy -- .sig)
> base56.tgz    (binary.  Easy -- .tgz)
> bsd           (binary)
> bsd.mp                (binary.  Easy -- .mp)
> bsd.rd                (binary.  Easy -- .rd)
> cd56.iso      (binary.  Easy -- .iso)
> cdboot                (binary)
> 
> Sure, the files that have an "extension" can be dealt with...lots of
> cases, but doable (fileset is finite and predictable).  But what about
> the files with no "extension" at all?  How do I tell it that SHA256 is
> text (often useful to have displayed as text on a browser) and bsd is
> binary (never display, just download)?

Here is an excerpt of the /etc/httpd.conf i'm currently using
on the mdocml.bsd.lv web server:

  types {
        text/css        css
        text/html       html
        text/plain      txt mdoc ChangeLog INSTALL LICENSE NEWS
        image/gif       gif
        image/jpeg      jpeg jpg
        image/png       png
  }

Binary is the default.

> (waiting for a well-deserved "rtfm ...")

More like RTFS.  The source code of media_find() in httpd.c shows
that "extension" simply means the last dot-separated component of
the filename, or the whole filename in the absence of any dot.

> (and grumpy about this CP/M-MSDOS concept of "extension" on Unix ...)

Maybe you should campaign for using file(1) instead.  Er, hmmm.
Or maybe not...  :-/

Yours,
  Ingo

Reply via email to