You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by David Hajoglou <ho...@isoftcorp.com> on 2000/04/27 06:48:11 UTC

how to rewrite to a POST

I asked a similar question eariler with no response.  So, I shall change
my aproach.

I have figured that I need to use PerlTransHandler for my module, but I
still do not know how to turn a GET request into a POST.

I can rewrite the filename to the correct file:

$r->filename($r->document_root . '/index.php3'); #from /auth?k=...

but, how do I make it a post?  Can I respecificy the $r->content?  It
would seem that I can't by the docs:

=== $r->content from perldoc Apache
*NOTE*: you can only ask for this once, as the entire body is read from
the client.
===

so, is it possible to take a GET request and rewrite the uri into a POST
request and if so how?




Re: how to rewrite to a POST

Posted by "J. J. Horner" <jh...@2jnetworks.com>.
On Thu, 27 Apr 2000, Ken Y. Clark wrote:

> On Wed, 26 Apr 2000, David Hajoglou wrote:
> 
> > so, is it possible to take a GET request and rewrite the uri into a POST
> > request and if so how?
> 
> i'm not sure if that's really necessary.  you could just put the GET args
> into $r->pnotes, perhaps like so:
> 
> sub handler {
>     my $r = shift;
>     return DECLINED unless $r->is_main();
> 
>     my $apr    = Apache::Request->new($r);
>     my @params = $apr->param;
>     my %args   = ();
>     $args{$_}  = $apr->param($_) for @params;
>     $r->pnotes('args', %args);
>     return OK;
> }
> 

In my situation, we sometimes have developers who try to send uids and
passwords across using a get.  This puts uids and passwords in the
logfile.  Is there a way to rewrite the GET to a POST before logging so as
to remove the uid/password data pairs?

Jon

-- 
J. J. Horner
Apache, Perl, Unix, Linux
jhorner@knoxlug.org http://www.knoxlug.org/


Re: how to rewrite to a POST

Posted by "Ken Y. Clark" <kc...@boston.com>.
On Wed, 26 Apr 2000, David Hajoglou wrote:

> so, is it possible to take a GET request and rewrite the uri into a POST
> request and if so how?

i'm not sure if that's really necessary.  you could just put the GET args
into $r->pnotes, perhaps like so:

sub handler {
    my $r = shift;
    return DECLINED unless $r->is_main();

    my $apr    = Apache::Request->new($r);
    my @params = $apr->param;
    my %args   = ();
    $args{$_}  = $apr->param($_) for @params;
    $r->pnotes('args', %args);
    return OK;
}

ky