You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Jason S. Priebe" <pr...@wral-tv.com> on 1998/03/04 18:26:56 UTC

ANNOUNCE: mod_trailer

-----BEGIN PGP SIGNED MESSAGE-----

Greetings!  I'm a new member of the list; I've primarily joined to
get some feedback on a module I've writte, and hopefully to contribute
it to the module registry.

As a fairly recent Netscape-to-Apache convert, one of the hurdles I 
faced was being able to add "trailers" to all documents site-wide. 
We had grown dependent on this feature of the Netscape server to allow
us to add a copyright and 'last modified at' message to every document
on the site.

So before moving to Apache, I whipped up this module.  We've been using
it with no problems for about 5 months on a server that receives up to 4 
million hits weekly.

The only drawback to the module is that it requires a change to the Apache
core.  In order for the server to send the correct Content-Length value to
the client, it must add the length of the trailer to the length of the
document served.  As far as I could tell, the Apache core would not let me
do this, so I modified set_content_length() in http_protocol.c.  The change
is simple, although it really is a hack.  If somebody knows of a better
way to do this, please let me know.  I changed a line reading

  r->clength = clength

  to 

  r->clength += clength

(and then subsequent uses of the variable clength were changed to use
r->clength).  mod_trailer calls set_content_length() with the computed
length of the trailer, passes off the request to the normal handler,
and when that handler returns, prints out the trailer.

I'd love to add this module to the module registry, and would be happy to
maintain it.  For the source and documentation, please see

http://www2.wral-tv.com/~priebe/webUtils/mod_trailer.tgz

Thanks, and I look forward to hearing from interested parties!

- --------------------------------------------------
Jason Priebe                           WRAL OnLine
priebe@wral-tv.com                     Raleigh, NC
see http://www.wral-tv.com/~priebe/ for public key                


-----BEGIN PGP SIGNATURE-----
Version: 2.6.2

iQCVAwUBNP2O4+qkj/9w/z2hAQGjmQP/eSiVHKyflxB3YfHQB1fzM8tVVTXKjmRe
5Skmb254+3+xu9wFvh0ZieNGtjcJx3/gpPSCum1gTZZaRpCjFh/wx9D36yA0BbkO
h7o0oPNpmxKyQ+jxq/jscPqPP33rn03kGBoPoP6uYjHIXk5rM5Qo3zpxFoqqaH3Y
LrfWgfkKM18=
=9KMM
-----END PGP SIGNATURE-----


Re: ANNOUNCE: mod_trailer

Posted by Dean Gaudet <dg...@arctic.org>.
You're calling process_request_internal().  That's not part of the API.
Neither is process_request().  Granted I can't blame you for making these
mistakes, the API isn't documented very well.

I think your code is also broken when combined with something like mod_cgi
or mod_include which don't create content-length headers.

However there is an example of code that does what you want:  mod_include.
To do this within the API and without a modification to the core you
need to do something like:

    rr = sub_req_lookup_uri(whatever-uri, r);
    run_sub_req(rr);

You need to issue your own headers as well.  And unfortunately there's no
way to know if the sub request is going to have a content-length in its
headers.  There is no way to set content length in this case.

Dean

On Wed, 4 Mar 1998, Jason S. Priebe wrote:

> http://www2.wral-tv.com/~priebe/webUtils/mod_trailer.tgz