You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2007/04/10 21:01:49 UTC

DO NOT REPLY [Bug 42082] New: - filter_init is called multiple times after an INCLUDES filter

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42082>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42082

           Summary: filter_init is called multiple times after an INCLUDES
                    filter
           Product: Apache httpd-2
           Version: 2.2.2
          Platform: All
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: All
        AssignedTo: bugs@httpd.apache.org
        ReportedBy: jz-2007@heute-morgen.de


Hi.

After an INCLUDES filter a subsequent filters filter_init function is called
once for the main document and once for each included document. It should be
called only once.

To check this a filter is used that counts the calls to filter_init (see below).

The output in the error log is:

[Tue Apr 10 07:43:45 2007] [debug] mod_count_init.c(24): [client 192.168.201.87]
ci_filter_init counted 1.
[Tue Apr 10 07:43:45 2007] [debug] mod_count_init.c(24): [client 192.168.201.87]
ci_filter_init counted 2.
[Tue Apr 10 07:43:45 2007] [debug] mod_count_init.c(24): [client 192.168.201.87]
ci_filter_init counted 3.
[Tue Apr 10 07:43:45 2007] [debug] mod_count_init.c(24): [client 192.168.201.87]
ci_filter_init counted 4.
[Tue Apr 10 07:43:45 2007] [debug] mod_count_init.c(24): [client 192.168.201.87]
ci_filter_init counted 5.
[Tue Apr 10 07:43:45 2007] [debug] mod_count_init.c(24): [client 192.168.201.87]
ci_filter_init counted 6.

-------------------------------------------------------------------------------
LoadModule ci_module modules/mod_count_init.so

AddOutputFilter  INCLUDES;count-init .html

bug.html----------------------------------------------------------------------
<html>
<!--#include virtual="test.txt" -->
<!--#include virtual="test.txt" -->
<!--#include virtual="test.txt" -->
<!--#include virtual="test.txt" -->
<!--#include virtual="test.txt" -->
</html>
test.txt----------------------------------------------------------------------
Test
mod_count_init.c--------------------------------------------------------------
/* 
 * Test for an apache 2.2 bug
 */

#include <apr.h>
#include <apr_general.h>
#include <apr_buckets.h>
#include <http_protocol.h>
#include <http_log.h>
#include <mpm.h>

module AP_MODULE_DECLARE_DATA ci_module;

/*****************************************************************************
 * The main filter
 *****************************************************************************/

/*
 * ci_filter_init
 */
static int ci_filter_init(ap_filter_t * f)
{
    int *cnt = (int *)(&f->ctx);
    ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, f->r,
                  "ci_filter_init counted %d.", ++(*cnt));

    return OK;
}

/**
 * Does nothing
 */
static int ci_filter(ap_filter_t * f, apr_bucket_brigade * bb)
{
    return ap_pass_brigade(f->next, bb);
}

/*****************************************************************************
 * The usual module stuff
 *****************************************************************************/

static void ci_hooks(apr_pool_t * p)
{
    ap_register_output_filter("count-init", ci_filter,
                              ci_filter_init, AP_FTYPE_RESOURCE);
}

module AP_MODULE_DECLARE_DATA ci_module = {
    STANDARD20_MODULE_STUFF, NULL, NULL, NULL, NULL,
    NULL, ci_hooks
};

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org