httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: redirect in post-read phase
Date Tue, 18 May 1999 23:15:39 GMT
Dean Gaudet <> writes:

> Yeah I know how it works -- people hack together a solution that appears
> to work using the first thing they find... and generally don't find the
> right solution the first time... and then report bugs on things which
> they're using in ways we didn't intend... and then when we ask, "why
> didn't the standard way that module foobar uses work for you?"  they say
> something like "oh, I didn't think of copying your examples"... to
> paraphrase things :) 
> Yeah yeah there's no docs.  But there's a bunch of examples :) 

Not sure to whom this was directed...

The modules in src/modules/standard/ do not all redirect the same way.

Fact is, before I sent my e-mail on this topic I read both _Apache The
Definitive Guide, 2nd ed._ and _Writing Apache Modules with C and Perl, 1st
ed._, *and* stepped through the code, *and* read the comments.

Consulting the index, _Writing Apache Modules with C and Perl, 1st ed._
covers the post-read phase on pages 72, 332, and 512. There is never really
any mention of what can and can't be done in this phase.

For example, on page 332:

        When a listening server receives an incoming request, it reads the
        HTTP request line and parses any HTTP headers sent along with
        it. Provided that what's been read is valid HTTP, Apache gives
        modules an early chance to step in during th _post_read_request_
        phase, known to the Perl API world as the
        _PerlPostReadRequestHandler_. This is the very first callback that
        Apache makes when serving an HTTP request, and it happens even
        before URI translation turns the requested URI into a physical

_Apache The Definitive Guide, 2nd ed._ covers the post-read phase on page
303. This however would seem to indicate that a module could redirect in
this phase.

On page 303:

        This function is called immediately after the request headers have
        been read, or, in the case of an internal redirect, synthesized. It
        is not called on subrequests. It can return OK, DECLIENED, or a
        status code. If something other than DECLINED is returned, no
        further modules are called. This can be used to make decisions
        purely based on the header content. Currently the only standard
        Apache module to use this hook is the proxy module.

Especially when you step through he code and see this being run:

                  "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n"
                  "<HTML><HEAD>\n<TITLE>", title,
                  "</TITLE>\n</HEAD><BODY>\n<H1>", h1, "</H1>\n",

	switch (status) {
	    ap_rvputs(r, "The document has moved <A HREF=\"",
		      ap_escape_html(r->pool, location), "\">here</A>.<P>\n",

If the post-read phase really isn't meant to be used like this, then I'd
say you need to revisit your use of ap_die() in ap_read_request(), and let
your colleagues know. 


Tom Vaughan <tvaughan at aventail dot com>

View raw message