Hi,

Currently having an intermittent problem with Apache, mod_perl and a content type handler. Might be fairly unlikely that anyone here can help, but thought I'd throw it out and see if anyone has seen anything similar.

Basically, I'm working on a high traffic site, which is running some mod_perl code. During the translation phase, it decides if it knows the content type of the file it's serving (which 99% of the time it does), and if so uses push_handlers() to add a content type handler. The content type handler simply sets the content type of the response correctly.

This is all well and good, but there are times (a very small percentage of traffic) when the content type for html files is set to text/plain, even though the app knows it should be text/html. As far as I can tell, there's no reason for the mod_perl content type handler to return text/plain.

To make matters slightly more interesting, Apache is actually configured with a DefaultType of text/html, which appears to be getting ignored (I've hacked the system so that the content type handler returns nothing, and I receive the text/plain header, not the text/html default I would expect).

So the problem seems to be (in the intermittent problem cases):
  1. Apache (or mod_perl?) is not reading the return value of the content type handler, and
  2. The DefaultType value is being ignored
Again, just to stress, the vast majority of requests are fine. There is no pattern in terms of specific pages on the site, specific servers, etc.

Admittedly, I can't be 100% sure the content type handler *is* actually returning something (and that it is returning text/html), but some of the other details of the system make me more sure than may be apparent in this post :)

So has anyone seen anything similar to this?

(BTW, Apache 1.3, mod_perl 1.3, perl 5.8.x)

In reply to Apache, mod_perl and content type handlers by Mutant

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.