Hi Geoffrey & Xavier,

I don't argue on the fact the Content-type is an entity header available in
both situations. However I'm talking about how to get/set in mod_perl the
Content-type in those 2 situations, which according to the mod_perl 1.0 API
docs and as I understand it, are different animals:

>>>>
1.7.8 $r->content_type( [$newval] )
Get or set the content type being sent to the client. Content types are
strings like "text/plain",
"text/html" or "image/gif". This corresponds to the "Content-Type" header in
the HTTP
protocol. Example of usage is:
$previous_type = $r->content_type;
$r->content_type("text/plain");
>>>>
...
>>>>
1.5.16 $r->header_in( $header_name, [$value] )

Return the value of a client header. Can be used like this:
$ct = $r->header_in("Content-type");
>>>>>>>

So, while I'm not 100% sure about this, logically the $r->content_type
should be empty before the response is prepared to be sent to the browser,
so it should be empty in the Fixup stage.

In fact what I miss (and I guess I'm not alone ;-) is a documentation that
would take the $r from the "newly born" state and describe what's
added/deleted to it during a full process loop, at each stage.
Besides I'd like to know about each major optional module (like mod_rewrite,
mod_ssl, etc) where they intervine in the loop and what they read/or set.
Most of these one can guess but I'm not aware of such a documentation.

Regards,

Lian Sebe, M.Sc.
Freelance Analyst-Programmer
www.programEz.net

> -----Original Message-----
> From: Geoffrey Young [mailto:[EMAIL PROTECTED]
> Sent: Thursday, August 07, 2003 5:36 AM
> To: Xavier Noria
> Cc: [EMAIL PROTECTED]
> Subject: Re: help on setting up a PerlFixupHandler
>
>
>
>
> Xavier Noria wrote:
> > [EMAIL PROTECTED] wrote:
> >
> >> It seems to me that $r->content-type is for what your server
> sends to the
> >> client, which is probably undef in the Fixup stage, where you test it.
> >>
> >> You probaly meant to test for the
> >> $ct = $r->header_in("Content-type")
> >> if you wanted to see whats requested from the client.
>
> Content-Type is an entity header, so it can apply to both incoming and
> outgoing headers.  however, it's more generally seen as an
> outgoing header
> for normal web activity, leaving headers_in empty.
>
> >
> >
> > But then, there are examples in the books that use that method that way.
> >
> > For instance, in recipe 14.1 of the Cookbook, which is about how to
> > disable a configured mod_perl PerlHandler, the "Technique" section says:
> >
> >   Set the handler back to the default Apache content handler from a
> >   PerlFixupHandler.
> >
> >   # Only run the PerlHandler for HTML.
> >   # For everything else, run the default Apache content handler.
> >   $r->handler('default-handler') unless $r->content_type eq 'text/html';
> >
> > I think in the Eagle book there is some code like that as well, cannot
> > check it right now however.
> >
> > So, looks like that test makes sense, or can make sense, in
> that handler.
>
> $r->content_type is generally set by mod_mime, during the
> mime-type phase,
> according to it's rules.  for most setups, it should be set to
> something by
> fixup, but I guess it's dependent on your particular settings.
>
> --Geoff
>

Reply via email to