Re: [mp2] how to redirect POST data

[prev] [thread] [next] [Date index for 2004/12/15]

From: Beberle
Subject: Re: [mp2] how to redirect POST data
Date: 01:32 on 15 Dec 2004
--- Tom Schindl <tomAtLinux@xxx.xx> wrote:

> Beberle wrote:
> > Hi,
> > 
> > I found a similar question posted in the
> newsgroups
> > but no one seemed to have a solution.  Here's what
> I'm
> > trying to do.  I have a web page that does a POST
> to a
> > remote server.  Basiscally, I'm trying to read the
> > post data and if it matches a regex, I want to
> > redirect it.  Otherwise, I want to let the POST
> > continue normally (submitting to the remote
> server).  
> > 
> > At the PerlTransHandler stage, I have a handler
> that
> > reads the post data like so:
> > 
> > my $method = $r->method();
> > if ($method =~ /post/i) {
> >     my $content;		  
> >     $r->read($content,
> >          $r->headers_in->{'content-length'});
> >     if ($content =~ /some_regex/){
> >         # redirect
> >     } else {
> >         # continue with post
> >         return OK;
> >     }
> > }
> > 
> > I can capture the POST data and redirect the user
> just
> > fine. The problem occurs with the submitted forms
> that
> > don't match the regex.  If I just return OK, the
> > browser hangs (because the POST data has been
> reset?).
> >  I'll admit I'm a bit confused as to what's
> actually
> > going on here (still new to mod_perl).  I read
> you're
> > not supposed to parse the form data except at the
> > ContentHandler step, but since the form is
> submitting
> > to a remote host, I can't really do that.
> > 
> 
> Not 100% sure what you are telling me here but why
> not simply use 
> Apache::Request->instance($r).
> 
> The problem with POSTED data is that you can not
> read them more than 
> once you can think of it like STDIN when read once
> you can not go back 
> and read it once more.

Right, that's exactly the problem I'm trying to work
around.  Once I've read the POST data, is there some
way to re-POST it?  

 


		
__________________________________ 
Do you Yahoo!? 
Jazz up your holiday email with celebrity designs. Learn more. 
http://celebrity.mail.yahoo.com

        -- 
        Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html

(message missing)

[mp2] how to redirect POST data
Beberle 10:43 on 13 Dec 2004

Re: [mp2] how to redirect POST data
Tom Schindl 12:02 on 13 Dec 2004

Re: [mp2] how to redirect POST data
Reenen C Kroukamp 12:44 on 13 Dec 2004

Re: [mp2] how to redirect POST data
Beberle 01:32 on 15 Dec 2004

Re: [mp2] how to redirect POST data
Joe Schaefer 02:50 on 15 Dec 2004

Re: [mp2] how to redirect POST data
Beberle 02:42 on 17 Dec 2004

Re: [mp2] how to redirect POST data
Joe Schaefer 04:45 on 17 Dec 2004

compile problems
Matthew Berk 07:05 on 17 Dec 2004

Re: compile problems
Stas Bekman 16:12 on 17 Dec 2004

Re: compile problems
Matthew Berk 14:44 on 20 Dec 2004

Generated at 12:15 on 16 Jan 2005 by mariachi v0.52