Re: Obtaining the Apache Content-type for a file
David Booth <[email protected]>
| Newsgroups | gmane.comp.apache.mod-perl |
|---|---|
| Message-ID | <1326474543.3832.73167.camel@dbooth-laptop> |
On Fri, 2012-01-13 at 16:06 +0100, André Warnier wrote: > I have a PerlResponseHandler which processes some kind of "logical document-id" provided > in a request, locates the corresponding "real document" on the filesystem, and returns it > to the client via sendfile(). > At the moment, this handler uses its own custom logic to determine the MIME type of the > document and return it to the client as a Content-type HTTP header. > > My question is : instead of this custom logic, does there exist a way, via mod_perl, to > obtain this target file's MIME-type from Apache, using Apache's own logic (mod_mime, > AddType etc..) for that ? This isn't exactly what you asked for, but if you don't need to server anything else along with it, then perhaps you could use internal_redirect http://perl.apache.org/docs/2.0/api/Apache2/SubRequest.html#C_internal_redirect_ and let Apache set the Content-Type for you. If you do find the direct answer to your question, please post it, as I'm interested in this question also. Thanks! -- David Booth, Ph.D. http://dbooth.org/ Opinions expressed herein are those of the author and do not necessarily reflect those of his employer.