Return-Path: Delivered-To: apmail-httpd-modules-dev-archive@minotaur.apache.org Received: (qmail 40492 invoked from network); 5 Jan 2011 19:41:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 5 Jan 2011 19:41:24 -0000 Received: (qmail 49465 invoked by uid 500); 5 Jan 2011 19:41:24 -0000 Delivered-To: apmail-httpd-modules-dev-archive@httpd.apache.org Received: (qmail 49400 invoked by uid 500); 5 Jan 2011 19:41:23 -0000 Mailing-List: contact modules-dev-help@httpd.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: modules-dev@httpd.apache.org Delivered-To: mailing list modules-dev@httpd.apache.org Received: (qmail 49392 invoked by uid 99); 5 Jan 2011 19:41:23 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Jan 2011 19:41:23 +0000 X-ASF-Spam-Status: No, hits=1.8 required=10.0 tests=HTML_FONT_FACE_BAD,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of jmarantz@google.com designates 216.239.44.51 as permitted sender) Received: from [216.239.44.51] (HELO smtp-out.google.com) (216.239.44.51) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Jan 2011 19:41:18 +0000 Received: from kpbe14.cbf.corp.google.com (kpbe14.cbf.corp.google.com [172.25.105.78]) by smtp-out.google.com with ESMTP id p05Jeuxv030643 for ; Wed, 5 Jan 2011 11:40:57 -0800 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta; t=1294256457; bh=iwwBcjA3xTYRDYcZshzplOfAsRM=; h=MIME-Version:In-Reply-To:References:From:Date:Message-ID:Subject: To:Content-Type; b=CUAqzpNkGNPRcJe2m/3mfE4PgGIiPm9TE59J+HPmRRe8Wa/Iqh++4Z63h1vTD1sFM g0JBa/U5lbtkkFUCpfuFQ== Received: from iye19 (iye19.prod.google.com [10.241.50.19]) by kpbe14.cbf.corp.google.com with ESMTP id p05Je5Bf020064 for ; Wed, 5 Jan 2011 11:40:55 -0800 Received: by iye19 with SMTP id 19so14631168iye.10 for ; Wed, 05 Jan 2011 11:40:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=beta; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:content-type; bh=4rx4MhW4BBx6qiCneeV5dYmjiBEcGSbKC2eJZfSaYiQ=; b=I4glNs60L3sR2u6oiJ0i20vrtsz8kGWW9ZcBnsgpmAxHfYCtIalWmI7CQRUSH/CPyd If4/sa7QPZtuco+ZQXug== DomainKey-Signature: a=rsa-sha1; c=nofws; d=google.com; s=beta; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; b=rfmpbr4c5HK0VbIaH136BNoRmx1JVOWw7FYLsahi94TyKGJS6HqmX6ZpQ3az5z+sr1 hZgCGfGfXqZ0RQwz3HsQ== Received: by 10.231.32.130 with SMTP id c2mr7558949ibd.35.1294256455610; Wed, 05 Jan 2011 11:40:55 -0800 (PST) MIME-Version: 1.0 Received: by 10.231.40.11 with HTTP; Wed, 5 Jan 2011 11:40:35 -0800 (PST) In-Reply-To: References: From: Joshua Marantz Date: Wed, 5 Jan 2011 14:40:35 -0500 Message-ID: Subject: Re: Help trying to figure out why an output_filter is not called. To: modules-dev@httpd.apache.org Content-Type: multipart/alternative; boundary=002215048fb748f09e04991e90c5 X-System-Of-Record: true --002215048fb748f09e04991e90c5 Content-Type: text/plain; charset=ISO-8859-1 On Wed, Jan 5, 2011 at 10:43 AM, Ben Noordhuis wrote: > > I guess we should eliminate FIXUP_HEADERS_OUT, FIXUP_HEADERS_ERR, and > > MOD_EXPIRES. > Are there any other similar header-mucking-filters I need to kill? > Moreover, expires_insert_filter runs as APR_HOOK_MIDDLE which means it > runs > > after my content-generator, which means that it won't have been inserted > by > > the time when I want to set my caching headers. > > You can remove it from your handler, scan > r->output_filters->frec->name to find the filter. > I'm not following you. mod_expires.c has this: static void expires_insert_filter(request_rec *r) { ...ap_add_output_filter("MOD_EXPIRES", NULL, r, r->connection);... } static void register_hooks(apr_pool_t *p) { /* mod_expires needs to run *before* the cache save filter which is * AP_FTYPE_CONTENT_SET-1. Otherwise, our expires won't be honored. */ ap_register_output_filter("MOD_EXPIRES", expires_filter, NULL, AP_FTYPE_CONTENT_SET-2); ap_hook_insert_error_filter(expires_insert_filter, NULL, NULL, APR_HOOK_MIDDLE); ap_hook_insert_filter(expires_insert_filter, NULL, NULL, APR_HOOK_MIDDLE); } So if I try to remove the 'expires' filter from my handler (which runs early) then mod_expires will have a handler that runs later that inserts it after my module has completed. Hence: > I guess that means I have to insert a new late-running hook that kills > > undesirable output filters. Does that wind up being simpler? > > The above is probably easier but whatever ends up being the most > readable / maintainable, right? > And also functional :) which, evidently, my current solution is not, at least in the presence of mod_perl and mod_php. Your solution has the advantage of being more robust when upstream filters write directly to the network. I just wish I didn't have to depend on my copies of string literals from .c files I don't control. But as you said core-filters will hopefully not change internal string constants often. I just coded it up and it seems to work :) -Josh --002215048fb748f09e04991e90c5--