Re: Obtaining the Apache Content-type for a file
André Warnier <[email protected]>
| Newsgroups | gmane.comp.apache.mod-perl |
|---|---|
| Message-ID | <[email protected]> |
David Booth wrote: > On Fri, 2012-01-13 at 12:09 -0500, David Booth wrote: >> 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. > > P.S. I just noticed lookup_file: > http://perl.apache.org/docs/2.0/api/Apache2/SubRequest.html#C_lookup_file_ > I haven't tried it, but it sounds like it *might* do what you want. > Thanks. I will have a look at both. I don't think I an use the internal_redirect in my case, lookup_file sounds interesting. I didn't think of looking there. but