Return-Path: Delivered-To: apmail-httpd-dev-archive@www.apache.org Received: (qmail 34996 invoked from network); 20 Sep 2008 17:16:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 20 Sep 2008 17:16:04 -0000 Received: (qmail 66530 invoked by uid 500); 20 Sep 2008 17:15:54 -0000 Delivered-To: apmail-httpd-dev-archive@httpd.apache.org Received: (qmail 66452 invoked by uid 500); 20 Sep 2008 17:15:54 -0000 Mailing-List: contact dev-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list dev@httpd.apache.org Received: (qmail 66438 invoked by uid 99); 20 Sep 2008 17:15:54 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 20 Sep 2008 10:15:54 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of minfrin@sharp.fm designates 72.32.122.47 as permitted sender) Received: from [72.32.122.47] (HELO chandler.sharp.fm) (72.32.122.47) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 20 Sep 2008 17:14:54 +0000 Received: from chandler.sharp.fm (localhost [127.0.0.1]) by chandler.sharp.fm (Postfix) with ESMTP id 39DC6130009 for ; Sat, 20 Sep 2008 12:14:57 -0500 (CDT) Received: from Macintosh.config (87-194-125-15.bethere.co.uk [87.194.125.15]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: minfrin@sharp.fm) by chandler.sharp.fm (Postfix) with ESMTP id EA0C7130004 for ; Sat, 20 Sep 2008 12:14:55 -0500 (CDT) Message-ID: <48D52F8E.8070203@sharp.fm> Date: Sat, 20 Sep 2008 19:14:54 +0200 From: Graham Leggett User-Agent: Thunderbird 2.0.0.16 (Macintosh/20080707) MIME-Version: 1.0 To: dev@httpd.apache.org Subject: Re: svn commit: r592951 - in /httpd/httpd/trunk: ./ docs/manual/mod/ include/ modules/filters/ modules/http/ server/ References: <20071107233112.524B91A9832@eris.apache.org> <20071201175055.73b07982@grimnir> <475205FA.90307@sharp.fm> <47FE8C3B.7040309@apache.org> <48D48991.1050306@force-elite.com> In-Reply-To: <48D48991.1050306@force-elite.com> Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg=sha1; boundary="------------ms080407050106020501070902" X-Virus-Scanned: ClamAV using ClamSMTP X-Virus-Checked: Checked by ClamAV on apache.org This is a cryptographically signed message in MIME format. --------------ms080407050106020501070902 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Paul Querna wrote: > +1, this revision r592951, and the derivate r647263 need to be > rethought. IMO is that this doesn't belong in the reqeust_rec. > > I'm only realizing this went in 10 months after the first commit, and 5 > months after it was rewritten in r647263, a sign of my inactivity in > httpd land, so I'm not gonna 'veto' it, but damn I really don't like > having this stuff on the reqeust_rec. Having had the time to think this through, to be honest I cannot think of a different place for it to go other than request_rec. At the core of the problem is a flaw that has been repeated over and over inside lots of modules within the server, and which this code partially fixes. The flaw is that by design, the core will allow a request to spawn a subrequest, but the core offers no functionality for the subrequest to read a request body. So you get the same repeated code, over and over again in various modules, incarnations of this: /* what we have now */ if ( ! we_are_a_subrequest) { read_request_body(); } else { ignore_body_somehow(); } Now whether it is relevant for a subrequest to read a request body isn't important, what's important is that the subrequest isn't even allowed to try, and the subrequest has to go out of its way to make sure it doesn't read from the network twice. The subrequest shouldn't have to care about this stuff. With the kept_body code, two new possibilities are available that have not been available before: - Where the admin wants to set aside the body to be re-read by subrequests, the kept_body filter makes this possible, by allowing a kept body to be reread by a subrequest safely. The subrequest now becomes a fully fledged subrequest, able to access everything the request can. - Where the admin doesn't want to set aside the body, the kept_body filter can be inserted anyway, with an empty brigade. This "caps" the input filter stack, guaranteeing that the network can never be read twice, regardless of how many times it tries to read from the network. These two possibilities together mean that any module is now free to try and read a request body if it wants to, and the kept_body filter guarantees that the underlying network is never read from twice. This in turn means that all the different variations of "detect subrequest and try to to read the body a second time" that are scattered around the code become obsolete and can be removed, resulting in a much simpler contract for module code, and a significantly cleaner server: /* a cleaner alternative */ read_request_body(); In order for the partial fix to become a full fix, the kept_body filter should be unconditionally added to all subrequests (with an empty brigade in the simplest case), and all the instances of the "if ( ! we_are_a_subrequest)" code should be collapsed and removed, and modules should be free to try and read the body as many times as they like, safe in the knowledge that the kept_body filter guarantees the network will only ever be read from once. Regards, Graham -- --------------ms080407050106020501070902 Content-Type: application/x-pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" Content-Description: S/MIME Cryptographic Signature MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIJNTCC AvUwggJeoAMCAQICEAxljuBYvPVR3WhH6nkbTPowDQYJKoZIhvcNAQEFBQAwYjELMAkGA1UE BhMCWkExJTAjBgNVBAoTHFRoYXd0ZSBDb25zdWx0aW5nIChQdHkpIEx0ZC4xLDAqBgNVBAMT I1RoYXd0ZSBQZXJzb25hbCBGcmVlbWFpbCBJc3N1aW5nIENBMB4XDTA3MTAxNDEyMzQyMVoX DTA4MTAxMzEyMzQyMVowXTEQMA4GA1UEBBMHTGVnZ2V0dDEPMA0GA1UEKhMGR3JhaGFtMRcw FQYDVQQDEw5HcmFoYW0gTGVnZ2V0dDEfMB0GCSqGSIb3DQEJARYQbWluZnJpbkBzaGFycC5m bTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALLUMqDEkhgiT7ePdkErBVE2tND+ 6C8ElWEOaCSdbAlvwUXgKFzIR7zaD6c1CS2czmBslMwEb3LJHPWjgPN497wSERghkeAa+Fyw WqydJr+6WE1G67wHsg67tmGPAxG0Lf6eKpsiyh+u0ojKk4n0mRZ6HQxu6PqZYzJ2vOrT4gYz u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