Re: how to rewrite to a POST

2000-04-27 Thread Jim Winstead

On Apr 27, David Hajoglou wrote:
> I need to use the post, because that is what php3 is expecting.  If
> anybody can think of any better way I would like to hear it.  If not, then
> is it possible to translate a GET uri into a POST uri with a
> PerlTransHandler (or any other handler for that matter)??

Does TWIG really care whether the request comes in via GET or POST?
PHP generally does not make a distinction between the two. They
would have had to have gone out of their way to make this a
requirement.  (And one that is probably easily fixed by a search&replace
of HTTP_POST_VARS with HTTP_GET_VARS.)

But I've never used TWIG, so I may be missing the problem.

You could write your own (very limited) "proxy" on the mod_perl
side that used LWP::UserAgent to actually make the request to the
backend. Not quite as easy as just leveraging mod_proxy, but I
don't think it would be terribly difficult, either.

Jim



Re: how to rewrite to a POST

2000-04-27 Thread David Hajoglou

Ok, looking at all the posts I need to spell all of it out.  I am using
the database through the backend to prevend any passwords from being
transmited and possibally cached in a browser.  Here is how it works:

Our user, lets call him John, loggs into our portal.  This is a microsoft
environment (www.asksimon.com).  He authenticates on an MS server.  At
that time, the microsoft server generates a random key with a time stamp,
which is | delineated, adds the user name and base64 encodes it. Then all
links for the user to check his e-mail are writen as:

http://twig.asksimon.org/auth?k=b64_encoded_sequence">email

When I get the request my handler, which is triggered to fly when
/auth is requested, looks at the key, queries the MsSql database and
checks the random key and time stamp.  If all checks out, the request is
rewriten into a post like so:

twig.asksimon.org/index.php3 [log_name => "name" log_passwd => "passwd"].

I get the passwd from the .org server thereby keeping any passwords from
being transmitted between the microsoft environment and the linux
environment.

I need to use the post, because that is what php3 is expecting.  If
anybody can think of any better way I would like to hear it.  If not, then
is it possible to translate a GET uri into a POST uri with a
PerlTransHandler (or any other handler for that matter)??

I would like to use pnotes (that would have been easy) but I am going
from mod_perl to mod_php thereby nullifyiing all of the mod_perl gadgets.


Thanks
David




Re: how to rewrite to a POST

2000-04-27 Thread Kip Cranford

On: Thu, 27 Apr 2000 09:06:24 EDT "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:
>
[ snip ]

This approach works, or you could use something like Apache::RequestNotes.
However, you still need to deal with file uploads potentially, which I don't
believe the RequestNotes does.

In my situation, file uploads are important, as is authentication.  I check
authentication credentials on every request, and redirect to a login page
immediately when the check fails.  In this case, posted information (including
the file upload information) would be lost, which isn't good if the user uploaded
a big file.  I work around this by doing a simple client-side authentication
check (I use cookies to hold a username, so just check to see if it exists),
which launches a sub-window allowing the user to authenticate if their cookie
has expired.  Not the most elegant, but the best I could come up with right now.  

I also store all the request information in pnotes like RequestNotes.  However,
I also store a refrence to the file upload information (if any) along with
information on where the file contents are located.

If there are better solutions out there, I'm all ears!


--kip



Re: how to rewrite to a POST

2000-04-27 Thread J. J. Horner

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
[EMAIL PROTECTED] http://www.knoxlug.org/




RE: how to rewrite to a POST

2000-04-27 Thread Geoffrey Young



> -Original Message-
> From: Ken Y. Clark [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, April 27, 2000 9:06 AM
> To: [EMAIL PROTECTED]
> Subject: Re: how to rewrite to a POST
> 
> 
> 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;
> }

or just use Apache::RequestNotes, which does all that for you (and parses
your cookies, if any, while it's at it...)

--Geoff

> 
> ky
> 



Re: how to rewrite to a POST

2000-04-27 Thread Ken Y. Clark

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