mod_gzip and static fastcgi applications

Prakash Kailasa <[email protected]>
Newsgroups gmane.comp.web.fastcgi.devel
Message-ID <[email protected]>
Hi,

We use fastcgi (at my workplace) for a several perl applications, both
static and dynamic. Recently, we added mod_gzip to the mix.

The compression works fine in case of dynamically started fastcgi
applications, but the output of static fastcgi apps does not go thru
the compression stage.

After much debugging, I've found that the fixups function in
mod_fastcgi.c is setting the value of the handler to
FASTCGI_HANDLER_NAME ("fastcgi-script") in case of static
applications, replacing the value set by mod_gzip.

Here's the relevant part of the code:

    if (fcgi_util_fs_get_by_id(r->filename, uid, gid))
    {
        r->handler = FASTCGI_HANDLER_NAME;
        return OK;
    }

The test above fails for dynamic apps, so there would be no change in
the handler (which happened in our case to be mod_gzip_handler) and
everything was fine.

I looked at the CHANGES file and found this item (under 2.4.0):

 *) Eliminate the need for SetHandler or AddHandler with static or 
    external applications.

Not knowing the fastcgi code throughly, I am not sure if this item
corresponds to the above code segment. But I am guessing that not
having either of these directives would leave the handler unset and
the fixups function is fixing this situation.

If I change the above test to include an additional check so that the
handler is fixed only if it is truly NULL,

    if (r->handler == NULL && fcgi_util_fs_get_by_id(r->filename, uid, gid))

gzip compression works in case of static applications as well.

My questions: Is this an appropriate fix? Does this break any other
situations? If so, what would be the right fix?

My environment:
    Apache 1.3.28
    mod_fastcgi 2.4.0
    mod_gzip 1.3.26.1a
    Linux 2.4.25

I am attaching the patch, if that is of any help.

Thanks for your time,
/prakash

-- 
|All language designers are arrogant. Goes with the territory...       |
|        -- Larry Wall                                                 |

___________________________________
fastcgi-developers mailing list
http://fastcgi.com/fastcgi-developers/
static-gzip-fix.patch (text/plain, 386 B)
--- mod_fastcgi.c.orig	2002-12-22 22:19:14.000000000 -0500
+++ mod_fastcgi.c	2004-10-04 16:36:30.000000000 -0400
@@ -2812,7 +2812,7 @@
 
     get_request_identity(r, &uid, &gid);
 
-    if (fcgi_util_fs_get_by_id(r->filename, uid, gid))
+    if (r->handler == NULL && fcgi_util_fs_get_by_id(r->filename, uid, gid))
     {
         r->handler = FASTCGI_HANDLER_NAME;
         return OK;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.