Return-Path: Delivered-To: apmail-perl-modperl-archive@www.apache.org Received: (qmail 91290 invoked from network); 7 Jan 2007 02:56:07 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 7 Jan 2007 02:56:07 -0000 Received: (qmail 43679 invoked by uid 500); 7 Jan 2007 02:56:08 -0000 Delivered-To: apmail-perl-modperl-archive@perl.apache.org Received: (qmail 43662 invoked by uid 500); 7 Jan 2007 02:56:08 -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 43651 invoked by uid 99); 7 Jan 2007 02:56:08 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 06 Jan 2007 18:56:08 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of mboorshtein@gmail.com designates 66.249.82.239 as permitted sender) Received: from [66.249.82.239] (HELO wx-out-0506.google.com) (66.249.82.239) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 06 Jan 2007 18:55:59 -0800 Received: by wx-out-0506.google.com with SMTP id i30so6793182wxd for ; Sat, 06 Jan 2007 18:55:38 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=DrTAL8pG8wVr9I0dwOSmi0LwtdCDgFuVLZbKDTxXl5XXXWBehbzmeEkUJ+yp/zLrEWV6p7zHkxaUk9Brc/NYooWe2UgRc0t6y/mYoMfCnFDvHt3Xpxv/IEe8PJFrk//6N+WJwtiQMLfR2/3ljFK8gjd8/jqhObagXWPD1kAx/r0= Received: by 10.90.113.18 with SMTP id l18mr1415157agc.1168138538934; Sat, 06 Jan 2007 18:55:38 -0800 (PST) Received: by 10.90.83.18 with HTTP; Sat, 6 Jan 2007 18:55:38 -0800 (PST) Message-ID: <800df6390701061855w2b0e27fasc03cbd879d33bac8@mail.gmail.com> Date: Sat, 6 Jan 2007 21:55:38 -0500 From: "Marc Boorshtein" To: modperl@perl.apache.org Subject: mod_perl Input Filter, cookies & mod proxy MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Checked: Checked by ClamAV on apache.org Hello, I'm trying to write a mod_perl based input filter that will change the cookies in a request and then pass the request to mod_proxy. I think i'm pretty close to figuring this out, but its not working. At this point I can confirm my filter is running and modproxy is running, but the cookies aren't changing. Here's my filter code: TestFilter.pm ------------------------------------------------------------------------------ package MyApache2::TestFilter; use Apache2::Filter; use Apache2::ServerUtil; use APR::Table; use Apache2::RequestRec; use base qw(Apache2::Filter); use Apache2::Const -compile => qw(OK :log); use APR::Const -compile => qw(:error SUCCESS); sub input : FilterRequestHandler { my($filter, $bb, $mode, $block, $readbytes) = @_; #... my $s = Apache2::ServerUtil->server; $s->log_error("server: log_error"); $ENV{HTTP_COOKIE} = "somecookie=somevalue;"; my $r = $filter->r; $s->log_error("r object : $r"); my $headers = $r->headers_in; $s->log_error("headers : $headers"); my $cookies = $headers->{Cookie}; $s->log_error("cookies object : $cookies"); $headers->{Cookie} = "mycookie=pleasework;"; $headers = $r->headers_in; $s->log_error("headers2 : $headers"); $cookies = $headers->{Cookie}; $s->log_error("cookies object2 : $cookies"); my $rv = $filter->next->get_brigade($bb, $mode, $block, $readbytes); return $rv unless $rv == APR::Const::SUCCESS; return Apache2::Const::OK; } sub output : FilterRequestHandler { my($filter, $bb) = @_; #... } 1; ------------------------------------------------------------------------------------------------------------------ Here's the log output: ------------------------------------------------------------------------------------------------------------------ [Sat Jan 06 21:45:18 2007] [notice] Apache/2.2.2 (Fedora) configured -- resuming normal operations [Sat Jan 06 21:45:25 2007] [error] server: log_error [Sat Jan 06 21:45:25 2007] [error] r object : Apache2::RequestRec=SCALAR(0x92f0d40) [Sat Jan 06 21:45:25 2007] [error] headers : APR::Table=HASH(0x93769a0) [Sat Jan 06 21:45:25 2007] [error] cookies object : ObPERM=%23userservcenterEmployeesuserservcenterCustomList%3D2%3A8%23; mycookie=myvalue; JSESSIONID=692416A2F98FD34638A79B2277E72E44; [Sat Jan 06 21:45:25 2007] [error] headers2 : APR::Table=HASH(0x930df98) [Sat Jan 06 21:45:25 2007] [error] cookies object2 : mycookie=pleasework; ------------------------------------------------------------------------------------------------------------------ Here is my configuration: ------------------------------------------------------------------------------------------------------------------ PerlModule MyApache2::TestFilter SetHandler perl-script PerlInputFilterHandler -MyApache2::TestFilter::input ProxyPass http://localhost:8080/ ------------------------------------------------------------------------------------------------------------------ When I reach the proxied resource, all of the cookies are being send, not just the "mycookie" cookie. Am what I am trying possible? Thanks Marc