Return-Path: Delivered-To: apmail-httpd-modules-dev-archive@minotaur.apache.org Received: (qmail 58505 invoked from network); 2 Apr 2009 12:12:48 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 2 Apr 2009 12:12:48 -0000 Received: (qmail 57791 invoked by uid 500); 2 Apr 2009 12:12:48 -0000 Delivered-To: apmail-httpd-modules-dev-archive@httpd.apache.org Received: (qmail 57766 invoked by uid 500); 2 Apr 2009 12:12:48 -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 57756 invoked by uid 99); 2 Apr 2009 12:12:48 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Apr 2009 12:12:48 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of sorinm@gmail.com designates 209.85.219.162 as permitted sender) Received: from [209.85.219.162] (HELO mail-ew0-f162.google.com) (209.85.219.162) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Apr 2009 12:12:40 +0000 Received: by ewy6 with SMTP id 6so485479ewy.24 for ; Thu, 02 Apr 2009 05:12:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=KLT8P5JMlbhzmrRO5L/whM8BbScCNRWpw5FMZkcplSA=; b=KMRLkC4XkFRhkPBltUw8q3/Qu1/k7DxZM0RfUNTwBaxp+q0QLI/p7VVTdRDP+16dsE C3NsAOPyUm+SAq5TPajC2IGqHt2OkpwWXVuTQ79Iu9d4G0ZMqincoPJSxSRHhfSKSaic /b/hivaNiDiMawm62v9uJBWnj/B/5IQdEF0tc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=mAsKipN0n6pn+sz89wG1b9V4ALd07XkD36lRfddx+Eqg6oaM6xy19Ht7F4j4SiwfkR 74uVKNqqOftSPut2LIWmhf4IxMXKupAngQfDWpP9kcNHhNddyoGan+E/XquaUeTU6yEx 2B2vywX0YybnTVpdxdGRmBSEbU5NO7irFboDs= MIME-Version: 1.0 Received: by 10.210.18.8 with SMTP id 8mr6861362ebr.27.1238674340041; Thu, 02 Apr 2009 05:12:20 -0700 (PDT) In-Reply-To: <22845761.post@talk.nabble.com> References: <22845761.post@talk.nabble.com> Date: Thu, 2 Apr 2009 14:12:19 +0200 Message-ID: <20170a030904020512w7b25e4bdwc8fc4ef1e4d8ae38@mail.gmail.com> Subject: Re: About the order of the processing of the http request From: Sorin Manolache To: modules-dev@httpd.apache.org Content-Type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org On Thu, Apr 2, 2009 at 13:28, Xiaobin wrote: > > Hi, everyone. > > I new to modlue developemnt of the Apache http server, and I have googled > this question and can't find the answer. Hope you can help me. Thx. > > I am confused with the order of the processing of the http request. > > Without the input/output filters, the order seems quick clear, when one http > request comes, it will go through different kinds of hooks like "map to > storage", "fixups" and "handler". And we can set some handlers to deal with > these hooks. > > But what's the order after the introduction of the filter mechanism? > > When will the input filters begin to work? > After the handlers of the fixups hook has been called and before the > handlers of the "handler" hook begin to work? > Or in some other order? > And how can we specify the order of the input filters? > > And for the output filters, when did they begin to work? Before or after the > "log transaction" hook ? > And also how can we specify the order of the output filters? > > Thank you very much for your help! There are several types of filters: network, protocol, connection, resource (the list is not exhaustive, check util_filters.h in the apache sources). The input headers of the request are read after the create_request hook and before the post_read_request, quick_handler, translate_name, map_to_storage, header_parser, access_checker, ..., fixups, insert_filter, and handler hooks. The output headers of the request are written during the handler execution. When the headers are read/written, the protocol filters are called. The resource input/output filters are called only when you explicitly read/write the body of the request. If you add filters with the SetInputFilter/SetOutputFilter directives, the filter is added in the insert_filter hook. This one is called after fixups and before handler. Thus, you cannot use a filter added with SetInputFilter/SetOutputFilter before the handler hook. log_transaction is called after the request was served and the response was written to the socket and the socket flushed. If the filters are of the same type, they are run in the order they were added. If they are of different types, then I think their type takes precedence, but I am not sure of that. For output filters, resource filters are called before network filters. S -- A: Because it reverses the logical flow of conversation. Q: Why is top-posting frowned upon? A: Top-posting. Q: What is the most annoying thing in e-mail?