Return-Path: Delivered-To: apmail-perl-modperl-archive@www.apache.org Received: (qmail 47651 invoked from network); 4 Aug 2005 23:26:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 4 Aug 2005 23:26:54 -0000 Received: (qmail 8602 invoked by uid 500); 4 Aug 2005 23:26:34 -0000 Delivered-To: apmail-perl-modperl-archive@perl.apache.org Received: (qmail 8565 invoked by uid 500); 4 Aug 2005 23:26:33 -0000 Mailing-List: contact modperl-help@perl.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list modperl@perl.apache.org Received: (qmail 8521 invoked by uid 99); 4 Aug 2005 23:26:33 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Aug 2005 16:26:33 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=RCVD_BY_IP,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of javiandalso@gmail.com designates 64.233.182.194 as permitted sender) Received: from [64.233.182.194] (HELO nproxy.gmail.com) (64.233.182.194) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Aug 2005 16:26:23 -0700 Received: by nproxy.gmail.com with SMTP id x4so109920nfb for ; Thu, 04 Aug 2005 16:26:30 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=Pq9QjWHbADnsmr8rO4knrdJ5zURGR1wxMIvFS/vWMQSkL11r+6zjMNPhpVUFHPMyCPTSalmhDd6fZ0NOGZMwnibBMNJhUaG2Fb+L/ly+VhwD8xxGmTPm+2cTPkzpTPfOvg3WocaolDXlazdZCdrH5MpWT32c3kd/cLqNX0JA64g= Received: by 10.48.239.19 with SMTP id m19mr78504nfh; Thu, 04 Aug 2005 16:26:30 -0700 (PDT) Received: by 10.48.49.19 with HTTP; Thu, 4 Aug 2005 16:26:30 -0700 (PDT) Message-ID: Date: Fri, 5 Aug 2005 01:26:30 +0200 From: =?ISO-8859-1?Q?Javier_Alonso_S=E1nchez?= Reply-To: =?ISO-8859-1?Q?Javier_Alonso_S=E1nchez?= To: modperl@perl.apache.org Subject: Proxy and Trans Handler Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hi again. I'd like to use Proxy Reserve configuration for certain POSTs, so trans handler seems a good way to change the header before Proxy phase. Any POSTs would continue their way to the Proxy directive whithout header changes, and others would change their header and wouldnt go to the Proxy. But, how can i do that ? Any suggestions ? I have made the next PerTransHandler, but the body doesn't arrive to the target uri. package MyApache2::HeaderParser; use strict; use warnings; use Apache2::RequestRec (); use Apache2::RequestIO (); use Apache2::RequestUtil (); use Apache2::ServerUtil (); use Apache2::ServerRec (); use Apache2::Process (); use Apache2::Connection (); use Apache2::Filter (); use APR::Table (); use Apache2::Const -compile =3D> qw(DECLINED OK); use constant METHOD =3D> 'POST'; sub handler { my $r =3D shift; return Apache2::Const::DECLINED unless $r->method eq METHOD; #my $content =3D content($r); my $content =3D $r->content(); warn("content: $content\n"); if (0) { my $newuri =3D '/~jasanchez/test/'; $r->uri($newuri); } return Apache2::Const::DECLINED; #return Apache2::Const::OK; } use APR::Brigade (); use APR::Bucket (); use Apache2::Const -compile =3D> qw(MODE_READBYTES); use APR::Const -compile =3D> qw(SUCCESS BLOCK_READ); use constant IOBUFSIZE =3D> 8192; sub content { my $r =3D shift; my $bb =3D APR::Brigade->new($r->pool, $r->connection->bucket_alloc); my $data =3D ''; my $seen_eos =3D 0; do { $r->input_filters->get_brigade($bb, Apache2::Const::MODE_READBYTES= , APR::Const::BLOCK_READ, IOBUFSIZE); for (my $b =3D $bb->first; $b; $b =3D $bb->next($b)) { if ($b->is_eos) { $seen_eos++; last; } if ($b->read(my $buf)) { $data .=3D $buf; } $b->remove; # optimization to reuse memory } } while (!$seen_eos); $bb->destroy; return $data; } 1; The body content after is EMPTY. Thanks