I'm rolling my own logging module for Apache (1.2b8 right now) and one of
the items I want to log is the MIME type which is sent out. My code is
based off of mod_log_common.c.
What in the Apache API should I be logging? Right now I'm using both of
the following:
(a) table_get(orig->headers_out, "Content-Type")
(b) orig->content_type
Both of these work AFAIK just right, EXCEPT when the request is for a
directory that contains an index.html Then "content_type" has
httpd/unix-directory (aka DIR_MAGIC_TYPE) and headers_out has... zilch!
(which is *wrong*... it is correctly sending text/html)
What's the deal here? Here's two consecutive requests to the same
directory, the first *without* an index.html, the second *with*.
clio.cgim.com^877125719^www.cgim.com^/staff/kangas/^^Mozilla/4.03
(Macintosh; U; PPC, Nav)^text/html^text/html^200^877
clio.cgim.com^877125765^www.cgim.com^/staff/kangas/^^Mozilla/4.03
(Macintosh; U; PPC, Nav)^^httpd/unix-directory^200^2609
The format is
client^unix_time^server^dir^args^agent^(a)^(b)^status^bytes_sent
Obviously I could just watch orig->content_type and look for
DIR_MAGIC_TYPE, replacing that with text/html, which would be right 99%
of the time. But what about redirects? CGI generated pages? Etc.
What's the approved way to go about this?
--
\7\3\d\e\k\b\8\u\o\x\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \
\m\a\t\t\.\k\a\n\g\a\s\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \