Return-Path: Delivered-To: apmail-httpd-modules-dev-archive@minotaur.apache.org Received: (qmail 99478 invoked from network); 20 Nov 2009 22:00:11 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 20 Nov 2009 22:00:11 -0000 Received: (qmail 73262 invoked by uid 500); 20 Nov 2009 22:00:10 -0000 Delivered-To: apmail-httpd-modules-dev-archive@httpd.apache.org Received: (qmail 73195 invoked by uid 500); 20 Nov 2009 22:00:10 -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 73184 invoked by uid 99); 20 Nov 2009 22:00:10 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 20 Nov 2009 22:00:10 +0000 X-ASF-Spam-Status: No, hits=-2.6 required=5.0 tests=BAYES_00 X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of sorinm@gmail.com designates 209.85.220.211 as permitted sender) Received: from [209.85.220.211] (HELO mail-fx0-f211.google.com) (209.85.220.211) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 20 Nov 2009 22:00:07 +0000 Received: by fxm3 with SMTP id 3so4165930fxm.24 for ; Fri, 20 Nov 2009 13:59:46 -0800 (PST) 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; bh=rsuf5e5kQ+CzoGBRL1UF+JQb+De9MXGDjGTLzcXILxE=; b=aF9PlOzjgvJfJ8gqXr9dgpIEG8m9JBpWknuGyGWlJbzcCJWQbIx706s2I9iwdBxWWx /H1LCUmeFHQXbmCeJVoCwZsd9V25JT0VRbIvoJ1wv+fudpkpO2cGoEcYphFFsr381yZS KVynojV2NkhoN4qsRQA5U9/pPM7ULuJAXdGjw= 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; b=IAY8I0CmI7/zLA/bguRjEBXpnr54d0exkcn2n6PzYyMpTzviNKHlj/dRDMOEx4h2Kq Xsr+EsYWiEVqm38UdsjwSyuUoe9ROSlUhlI+D/68Q9w61cAWZCcrKlGrVhH6sPRxODrg /fSfJAFelnKfkA9zuRj8/J8wv/JTCcnuE1XYM= MIME-Version: 1.0 Received: by 10.103.50.21 with SMTP id c21mr955078muk.27.1258754386344; Fri, 20 Nov 2009 13:59:46 -0800 (PST) In-Reply-To: <404e5e360911201301p2e5b7d75qf47a909e550f52b2@mail.gmail.com> References: <404e5e360911201301p2e5b7d75qf47a909e550f52b2@mail.gmail.com> Date: Fri, 20 Nov 2009 22:59:46 +0100 Message-ID: <20170a030911201359p69bcd433j356ed72d7d252926@mail.gmail.com> Subject: Re: Reading post parameters from apache request From: Sorin Manolache To: modules-dev@httpd.apache.org Content-Type: text/plain; charset=ISO-8859-1 On Fri, Nov 20, 2009 at 22:01, pranil dasika wrote: > Hi, > > I am trying to write a custom module where I need to read post parameters > from the request. I guess apreq library is relevant to this but could not > find any substantial examples or documents. > Is there any other way to read the params other than apreq. Any pseudocode/ > examples will be appreciated. > > Thanks, > Pranil > Here you have an example. It is not optimal, you could, for example, take the brigade creation out of the loop and clean the brigade at the end of each iteration, after you extracted the data. apr_bucket_brigade *bb; do { bb = apr_brigade_create(req->pool, req->connection->bucket_alloc); if (0 == bb) // error if (APR_SUCCESS != ap_get_brigade(req->input_filters, bb, AP_MODE_READBYTES, APR_BLOCK_READ, 9216)) // error extract data from bb; } while (EOS not yet encountered in bb); S