Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 81943200BE3 for ; Thu, 22 Dec 2016 15:05:39 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 802C3160B26; Thu, 22 Dec 2016 14:05:39 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id CA4DF160B1F for ; Thu, 22 Dec 2016 15:05:38 +0100 (CET) Received: (qmail 99370 invoked by uid 500); 22 Dec 2016 14:05:37 -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 99359 invoked by uid 99); 22 Dec 2016 14:05:37 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 22 Dec 2016 14:05:37 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 365C31A0440 for ; Thu, 22 Dec 2016 14:05:37 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -2.299 X-Spam-Level: X-Spam-Status: No, score=-2.299 tagged_above=-999 required=6.31 tests=[HTML_MESSAGE=2, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_MED=-2.3, RP_MATCHES_RCVD=-2.999] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id j-aSb9X41edu for ; Thu, 22 Dec 2016 14:05:35 +0000 (UTC) Received: from v1.rz.uni-leipzig.de (v1.rz.uni-leipzig.de [139.18.1.26]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 335975F58E for ; Thu, 22 Dec 2016 14:05:35 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by v1.rz.uni-leipzig.de (Postfix) with ESMTP id DDCD9E0008 for ; Thu, 22 Dec 2016 15:05:24 +0100 (CET) X-Virus-Scanned: by amavisd-new at v1-ul Received: from v1.rz.uni-leipzig.de ([127.0.0.1]) by localhost (v1.rz.uni-leipzig.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tjL8VHrMPCL1 for ; Thu, 22 Dec 2016 15:05:24 +0100 (CET) Received: from hogwarts.imise.uni-leipzig.de (hogwarts.imise.uni-leipzig.de [139.18.158.12]) by v1.rz.uni-leipzig.de (Postfix) with ESMTPS id C219FE0006 for ; Thu, 22 Dec 2016 15:05:24 +0100 (CET) X-Kerio-Anti-Spam: Build: [Engines: 2.15.8.1077, Stamp: 3], Multi: [Enabled, t: (0.000009,0.034037)], BW: [Enabled, t: (0.000008)], RTDA: [Enabled, t: (0.025937), Hit: No, Details: v2.4.2; Id: 2m1gj11.1b4b8qlu2.62ihc], total: 0(700) X-Footer: aW1pc2UudW5pLWxlaXB6aWcuZGU= Received: from localhost ([127.0.0.1]) by hogwarts.imise.uni-leipzig.de with ESMTPSA for modules-dev@httpd.apache.org; Thu, 22 Dec 2016 15:05:24 +0100 Date: Thu, 22 Dec 2016 15:05:24 +0100 Subject: Re: Change the content-length header for other filters X-User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0 Message-ID: <650227071-7335@hogwarts.imise.uni-leipzig.de> X-Priority: 3 Importance: Normal MIME-Version: 1.0 From: Andre Rothe To: modules-dev@httpd.apache.org Content-Type: multipart/alternative; boundary="=-q6JrFAg5M+xC490auOqm" archived-at: Thu, 22 Dec 2016 14:05:39 -0000 --=-q6JrFAg5M+xC490auOqm Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Hello, I've got the source code of mod_WebObjects, which=20 is the destination module of the request. It registers a=20 handler to process the incoming requests like ap_hook_handler(WebObjects_handler, NULL, NULL, APR_HOOK_MIDDLE); As I understand the Apache request processing, in this case the=20 content generator is the mod_WebObjects (or the WebObjects=20 Application Server behind it) and my filter (input and output) are=20 placed by mod_ext_filter in the data processing axis.=20 Is it necessary to set mod_WebObjects as successor of mod_ext_filter to define an order within the processing axis too? Within the WebObjects_handler hook the request_rec will be read and=20 the headers_in table will be copied into an own structure with retval =3D ap_setup_client_block(r, REQUEST_CHUNKED_ERROR); apr_table_do(...); There the content-length header will be used to allocate a buffer for=20 the content and the method reads the body content by ap_get_client_block(...) into that buffer. So it could be, that all of these things are finished in=20 mod_WebObjects during my filter code processes the new length=20 and ap_get_client_block() waits till body data are available (after my filter code).=20 Can I stop the header processing in mod_WebObjects (before=20 apr_table_do()), maybe if I read the bucket brigade till EOS there?=20 It should only be possible after my filter returns APR_SUCCESS, right? In mod_ext_filter I read the whole body before processing, because I=20 will get also an exception, if the request has two or more chunks. So I=20 read all chunks, copy it into one brigade (setaside), process it=20 in the external PHP scripts and send it further as one brigade.=20 This could generate performance issues, but at the moment,=20 the application is still very fast.=20 Thank you Andr=C3=A9 Von: Nick Kew =20 An: =20 Gesendet: 12/22/2016 2:05 AM=20 Betreff: Re: Change the content-length header for other filters=20 On Wed, 2016-12-21 at 22:10 +0100, Andr=C3=A9 Rothe wrote:=20 =20 > But after my filter completes the request processing, I'll get:=20 > =20 > Sending error response: The request contained fewer content data than=20 > specified by the content-length header=20 =20 Sorin's reply is part of the story, and may or may not be useful=20 in your case.=20 =20 The basic issue you have to consider is that the headers arrive before=20 the body, and a handler that cares about Content-Length is likely=20 to have read it before your filter has reset it.=20 =20 The alternative - read and buffer the entire body before starting=20 to process it - becomes hopelessly inefficient for large requests.=20 =20 There's some discussion of the issue in the mod_proxy docs,=20 as mod_proxy has an option to support HTTP/1.0 backends that=20 need an explicit Content-Length.=20 =20 -- =20 Nick Kew=20 =20 = --=-q6JrFAg5M+xC490auOqm--