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. -- David Booth, Ph.D. http://dbooth.org/ Opinions expressed herein are those of the author and do not necessarily reflect those of his employer.