35 messages in org.apache.perl.modperlRe: [mp2] how to redirect POST data
FromSent OnAttachments
BeberleDec 13, 2004 2:43 am 
Tom SchindlDec 13, 2004 4:02 am 
Reenen C KroukampDec 13, 2004 4:44 am 
BeberleDec 14, 2004 5:32 pm 
Joe SchaeferDec 14, 2004 6:49 pm 
BeberleDec 16, 2004 6:42 pm 
Joe SchaeferDec 16, 2004 8:44 pm 
Matthew BerkDec 16, 2004 11:05 pm 
Stas BekmanDec 17, 2004 8:11 am 
Barksdale, RayDec 17, 2004 8:57 am 
Joe SchaeferDec 17, 2004 10:27 am 
Stas BekmanDec 17, 2004 10:38 am 
Barksdale, RayDec 17, 2004 11:04 am 
Stas BekmanDec 17, 2004 11:25 am 
Barksdale, RayDec 17, 2004 1:04 pm 
Stas BekmanDec 17, 2004 1:19 pm 
Barksdale, RayDec 17, 2004 3:37 pm 
Stas BekmanDec 17, 2004 3:44 pm 
Matthew BerkDec 20, 2004 6:43 am 
Barksdale, RayDec 22, 2004 7:19 am 
Stas BekmanDec 22, 2004 12:27 pm 
Barksdale, RayDec 22, 2004 12:37 pm 
Stas BekmanDec 22, 2004 1:16 pm 
Barksdale, RayDec 22, 2004 2:01 pm 
Stas BekmanDec 22, 2004 2:22 pm 
Barksdale, RayDec 22, 2004 3:06 pm 
Stas BekmanDec 22, 2004 4:01 pm 
Barksdale, RayDec 28, 2004 2:50 pm 
Stas BekmanDec 28, 2004 3:01 pm 
Barksdale, RayDec 28, 2004 3:14 pm 
Stas BekmanDec 28, 2004 3:17 pm 
Barksdale, RayDec 28, 2004 3:50 pm 
Joe SchaeferDec 28, 2004 5:29 pm 
Barksdale, RayDec 29, 2004 8:59 am 
Stas BekmanDec 29, 2004 9:21 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [mp2] how to redirect POST dataActions...
From:Tom Schindl (tomA@gmx.at)
Date:Dec 13, 2004 4:02:20 am
List:org.apache.perl.modperl

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.

Any ideaas?

In mp2 you could also use an input-filter for this purpose.

Thanks, Bill