[Catacomb] Re: Content-type question.
On Tue, Sep 10, 2002 at 12:08:18PM -0700, email@example.com wrote:
> Date: Mon, 9 Sep 2002 20:42:19 -0700 (PDT)
> From: Sung Kim <firstname.lastname@example.org>
> To: email@example.com
> Subject: [Catacomb]
> Do you know how can we deal the content type with the PUT method? Several clients such as Skunkdav always give me "application/octet-stream".
> Let's suppose a client PUT "index.html" with "application/octet-stream". Should we also say index.html's content type is "application/octet-stream", when a client try to GET?
If the client sends the wrong type, then the client is the problem. I don't
see a big need to support bad clients. That will just continue to ensure
that they will always use bad behavior.
Take the supplied Content-Type and store it.
> I asked several server implementers, and they said usually they ignore PUT content-type.
mod_dav_fs ignores it, but don't take that as gospel. That is mostly for
performance reasons -- where would we put it? and how would we fetch it
again? I chose to use Apache's builtin mime type determination instead.
> Than, how can we figure out content type with filename?
> Does Apache have "const char *apr_get_content_type(const char *filename)". I tried to find, but I couldn't find that kind of function. Mod_dav looks like to use "ap_sub_req_lookup_uri", but it doesn't work with Catacomb.
This kind of stuff is in mod_mime and mod_mime_magic, I believe. Since those
functions are in a module rather than Apache "proper", there isn't really a
way to call them.
> Should I parse "mime.types"?
No, I don't think so. If you can identify a function within Apache to do the
file-extension to type mapping (if you go that route), then we can see about
getting it moved to an appropriate spot and exported from Apache.
Greg Stein, http://www.lyra.org/