perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Torsten Foertsch <>
Subject Re: Mod Perl 2.0 HTTP Handlers
Date Sun, 02 Nov 2008 12:25:17 GMT
On Sun 02 Nov 2008, Torsten Foertsch wrote:
> On Sun 02 Nov 2008, Puneet Lakhina wrote:
> > > Input headers are found in $r->headers_in and are set even before
> > > PerlPostReadRequest. So, have a close look at your code. If that
> > > doesn't help try to create a test case as simple as you can and
> > > post it to the list.
> >
> > Not as per this:
> >
> >rs _in_
> Then the documentation is wrong.

To show you that that is not an modperl-thing but implemented that way 
in apache, let's have a look at the ultimate docs. In 
httpd-2.x.y/server/protocol.c you'll find the ap_read_request function. 
It reads in a request, finds the virtual host that handles the request 
and calls PostReadRequest handlers. It is a bit lengthy. So I have 
removed the unnecessary for the problem stuff and put in a few 

request_rec *ap_read_request(conn_rec *conn)
    r->headers_in      = apr_table_make(r->pool, 25);

Here $r->headers_in is created as an empty table.

    /* Get the request... */
    if (!read_request_line(r, tmp_bb)) {

This reads the first request line, something like "GET / HTTP/1.1"

    if (!r->assbackwards) {
        ap_get_mime_headers_core(r, tmp_bb);

And this line reads in the headers and populates $r->headers_in.

        if (apr_table_get(r->headers_in, "Transfer-Encoding")
            && apr_table_get(r->headers_in, "Content-Length")) {

You see, even the function itself uses $r->headers_in.


Another example of $r->headers_in usage. Here the correct 
NamedVirtualHost is found. This function needs the Host request header.

    if ((access_status = ap_run_post_read_request(r))) {

And here a PerlPostReadRequestHandler is called.



Need professional mod_perl support?
Just hire me:

View raw message