Return-Path: Delivered-To: apmail-httpd-modules-dev-archive@locus.apache.org Received: (qmail 89324 invoked from network); 17 Jul 2008 21:52:47 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 17 Jul 2008 21:52:47 -0000 Received: (qmail 59579 invoked by uid 500); 17 Jul 2008 21:52:46 -0000 Delivered-To: apmail-httpd-modules-dev-archive@httpd.apache.org Received: (qmail 59561 invoked by uid 500); 17 Jul 2008 21:52:46 -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 59550 invoked by uid 99); 17 Jul 2008 21:52:46 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 Jul 2008 14:52:46 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of sorinm@gmail.com designates 209.85.146.180 as permitted sender) Received: from [209.85.146.180] (HELO wa-out-1112.google.com) (209.85.146.180) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 Jul 2008 21:51:51 +0000 Received: by wa-out-1112.google.com with SMTP id k17so48996waf.0 for ; Thu, 17 Jul 2008 14:52:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=zKgsH+yrc0Cdy+km1nuqGh1YNtRi7cOYjp4f8KdFq+Q=; b=GZTksVZ6/fwERXtmCGlDgl9P3jfFnSWMLcP7S+A5skm3RcaJggHCLdUJiQbLFUBNbc vtbLr0qXQaJgZJHvBIuzQg/B7ZGOqK9G5X5qEyD3fmsNZaVS3f5kERTbSBqc2ZX+/6t+ 8GUGf8EYxcUb94I6Ewl6FVRA7el2CjEXyJOkw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=DbdabM86BFC864IiFZUio6UjdpIfXE0Jju6rWrn1E0VxmTHTKRmLqg+wztv5SRF++/ ArupidNEix7b5nXB7AHoZZc6Qcba7DTKd5Dbgj0io5YAi3kAxHCVs+wP++eIzCpqiOpS uKd/YJIsTnZD7sfy3qQ9TsA9WPf5dY86kVLNg= Received: by 10.114.195.19 with SMTP id s19mr2170329waf.189.1216331535679; Thu, 17 Jul 2008 14:52:15 -0700 (PDT) Received: by 10.115.23.13 with HTTP; Thu, 17 Jul 2008 14:52:15 -0700 (PDT) Message-ID: <20170a030807171452w98a6addna1b7d139650b9289@mail.gmail.com> Date: Fri, 18 Jul 2008 00:52:15 +0300 From: "Sorin Manolache" To: modules-dev@httpd.apache.org Subject: Re: ap_get_client_block vs bucket brigades In-Reply-To: <98b241bd0807171206o6e1a6b4ai8d85f57bf7b68f45@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <98b241bd0807171206o6e1a6b4ai8d85f57bf7b68f45@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org On 2008-07-17, Jason Fister wrote: > Hello there, > > I have a module thats working as designed and the only reason I am sending > this mail is because I want to confirm what I am doing is the correct way to > do it. > > A little background: > > We wanted to convert some legacy services to REST webservice. Clients can > upload and retrieve data using this service. So I wrote an apache module > that can be accessed at http://www.mydomain.com/rest/. > > Clients can POST, PUT, GET to this uri. I use ap_get_client_block to read > the http body in case of POST and PUT. I know when we use the > ap_get_client_block method to read the data, the data is not available that > point onwards to any other filter/module and that is totally fine. Thats > because when the uri has '/rest' in it, the data is meant for my module. > > I have been doing some online reading and now I am wondering if I shld have > used buckets/brigades in my module. > > 1. Is my approach totally wrong? Just a caveat. Loop like this: while ((n = ap_get_client_block()) > 0) ... and not while (already_read < request->remaining) { n = ap_get_client_block(); alread_read += n; } request->remaining may be misleading, for example if the client PUSHes compressed data request->remaining will indicate the size of the compressed data while your module will most likely read the data that is already decompressed by the DEFLATE filter on the input filter chain. > 2. Will the use of bucket brigades have a positive impact on the > performance? Most likely not. > > Your help in understanding this issue is much appreciated. > > > > Jason >