You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Sean Davis <sd...@mail.nih.gov> on 2005/01/19 16:11:50 UTC

Auth handler and Registry scripts

This is a simple not-understanding-the-issues question, I'm sure.  I 
have an authen handler (that used Apache::Request, Apache::Cookie, and 
Apache::Session) in front of a uri serving a Registry script that runs 
using CGI.  The script works fine without the handler in place, but 
when I put the handler in place (which also seems to do what I want), I 
seem to be losing the ability to do post requests (I get the content, 
but the changes made on the previous form page are not reflected on the 
update).  Is the issue that I need to change all the post parameters to 
args for a get and do a redirect?

Thanks,
Sean


Re: Auth handler and Registry scripts

Posted by Tom Schindl <to...@gmx.at>.
* do you know that many browsers don't support an aribary length of get 
requests? That's why big forms often use POST and

* a major disadvantage of GET is that it is visible in browsers history. 
The next one who works on the computer can see what the last person sent 
to your URL which is most of the time not what you want, although he 
can't change anything beside when the GET holds the user/password (e.g. 
after a change password request).

* file-uploads doesn't work

So be aware of these problems when using GET as your forms method.

Tom

Sean Davis wrote:
> 
> On Jan 19, 2005, at 10:11 AM, Sean Davis wrote:
> 
>> This is a simple not-understanding-the-issues question, I'm sure.  I 
>> have an authen handler (that used Apache::Request, Apache::Cookie, and 
>> Apache::Session) in front of a uri serving a Registry script that runs 
>> using CGI.  The script works fine without the handler in place, but 
>> when I put the handler in place (which also seems to do what I want), 
>> I seem to be losing the ability to do post requests (I get the 
>> content, but the changes made on the previous form page are not 
>> reflected on the update).  Is the issue that I need to change all the 
>> post parameters to args for a get and do a redirect?
>>
> 
> I tried it (changing post to get, that is).  Fixed the problem.
> 
> Sorry to waste the list's time.
> 
> Sean
> 
> 


Re: Auth handler and Registry scripts

Posted by Geoffrey Young <ge...@modperlcookbook.org>.

Sean Davis wrote:
> 
> On Jan 19, 2005, at 1:45 PM, Joe Schaefer wrote:
> 
>> Sean Davis <sd...@mail.nih.gov> writes:
>>
>> [...]
>>
>>> Thanks Joe, Tom, and Geoff for the replies.  To answer all of you:
>>>
>>> I am NOT using mp2 and I think the behavior is documented for mp1, as
>>> others have suggested.
>>
>>
>> True, you can't share the post data in an apache-1 server, so
>> either use the POST-to-GET kludge, or make sure all the modules
>> use the same parsing library (CGI.pm).

I think this stopped working as of CGI.pm 3.03 or thereabouts, but it might
be worth a whirl anyway, just in case :)

http://www.modperlcookbook.org/~geoff/modules/experimental/Apache-CachePOSTRegistry-0.01.tar.gz

--Geoff

Re: Auth handler and Registry scripts

Posted by Sean Davis <sd...@mail.nih.gov>.
On Jan 19, 2005, at 1:45 PM, Joe Schaefer wrote:

> Sean Davis <sd...@mail.nih.gov> writes:
>
> [...]
>
>> Thanks Joe, Tom, and Geoff for the replies.  To answer all of you:
>>
>> I am NOT using mp2 and I think the behavior is documented for mp1, as
>> others have suggested.
>
> True, you can't share the post data in an apache-1 server, so
> either use the POST-to-GET kludge, or make sure all the modules
> use the same parsing library (CGI.pm).
>
>> As for using Apache::Request->instance(), the CGI code is legacy code
>> and uses CGI.pm exclusively, so I don't have the option of using the
>> Apache::Request object without some code wading (not now).  Just out
>> of curiosity, though, will something as simple as:
>>
>> $r = Apache::Request->instance();
>> $q = CGI->new($r);
>>
>> work when using the instance method under mp1 regardless of whether 
>> the
>> Apache::Request->instance() has been used in a prior handler?
>
> No, that won't work.  It will work in mp2 though, because apache 2.x 
> has
> a much richer IO (filtering) scheme.  The mp2 version of 
> Apache::Request
> takes advantage of that.  CGI.pm doesn't though, so you need to be sure
> Apache::Request is invoked before CGI.pm consumes all the post data.
> But the situation of an auth-handler using Apache::Request, with a
> Registry script using CGI.pm, should just work in mp2.  No kludges
> required there.
>

As I suspected.  Thanks for the details.

Sean


Re: Auth handler and Registry scripts

Posted by Joe Schaefer <jo...@sunstarsys.com>.
Sean Davis <sd...@mail.nih.gov> writes:

[...]

> Thanks Joe, Tom, and Geoff for the replies.  To answer all of you:
>
> I am NOT using mp2 and I think the behavior is documented for mp1, as
> others have suggested.  

True, you can't share the post data in an apache-1 server, so
either use the POST-to-GET kludge, or make sure all the modules 
use the same parsing library (CGI.pm).

> As for using Apache::Request->instance(), the CGI code is legacy code
> and uses CGI.pm exclusively, so I don't have the option of using the
> Apache::Request object without some code wading (not now).  Just out
> of curiosity, though, will something as simple as:
>
> $r = Apache::Request->instance();
> $q = CGI->new($r);
>
> work when using the instance method under mp1 regardless of whether the
> Apache::Request->instance() has been used in a prior handler?

No, that won't work.  It will work in mp2 though, because apache 2.x has
a much richer IO (filtering) scheme.  The mp2 version of Apache::Request 
takes advantage of that.  CGI.pm doesn't though, so you need to be sure 
Apache::Request is invoked before CGI.pm consumes all the post data.
But the situation of an auth-handler using Apache::Request, with a
Registry script using CGI.pm, should just work in mp2.  No kludges
required there.

-- 
Joe Schaefer


Re: Auth handler and Registry scripts

Posted by Sean Davis <sd...@mail.nih.gov>.
On Jan 19, 2005, at 11:03 AM, Joe Schaefer wrote:

> Sean Davis <sd...@mail.nih.gov> writes:
>
>> On Jan 19, 2005, at 10:11 AM, Sean Davis wrote:
>>
>>> This is a simple not-understanding-the-issues question, I'm sure.  I
>>> have an authen handler (that used Apache::Request, Apache::Cookie, 
>>> and
>>> Apache::Session) in front of a uri serving a Registry script that
>>> runs using CGI.  The script works fine without the handler in place,
>>> but when I put the handler in place (which also seems to do what I
>>> want), I seem to be losing the ability to do post requests (I get the
>>> content, but the changes made on the previous form page are not
>>> reflected on the update).  Is the issue that I need to change all the
>>> post parameters to args for a get and do a redirect?
>>>
>>
>> I tried it (changing post to get, that is).  Fixed the problem.
>
> If you're using mp2, that shouldn't be necessary. If you
> are, can you be more specific about the problem?  Also, which
> version of Apache::Request are you using?
>
> -- 
> Joe Schaefer
>

Thanks Joe, Tom, and Geoff for the replies.  To answer all of you:

I am NOT using mp2 and I think the behavior is documented for mp1, as 
others have suggested.  As for using Apache::Request->instance(), the 
CGI code is legacy code and uses CGI.pm exclusively, so I don't have 
the option of using the Apache::Request object without some code wading 
(not now).  Just out of curiosity, though, will something as simple as:

$r = Apache::Request->instance();
$q = CGI->new($r);

work when using the instance method under mp1 regardless of whether the 
Apache::Request->instance() has been used in a prior handler?

As for the URI lengths and logging, I do custom logging to a private 
RDBM, so not a big deal.  Also, since the GET is done WITHIN the 
request (VERY COOL, mod_perl is) and NOT as a redirect, the browser URL 
is never updated, so to the user, it appears like a post and security 
isn't so much an issue.  The username and password never pass through a 
GET method; in fact, the CGI script doesn't even know that the 
Authentication process has occurred.

Thanks again,
Sean


Re: Auth handler and Registry scripts

Posted by Joe Schaefer <jo...@sunstarsys.com>.
Sean Davis <sd...@mail.nih.gov> writes:

> On Jan 19, 2005, at 10:11 AM, Sean Davis wrote:
>
>> This is a simple not-understanding-the-issues question, I'm sure.  I
>> have an authen handler (that used Apache::Request, Apache::Cookie, and
>> Apache::Session) in front of a uri serving a Registry script that
>> runs using CGI.  The script works fine without the handler in place,
>> but when I put the handler in place (which also seems to do what I
>> want), I seem to be losing the ability to do post requests (I get the
>> content, but the changes made on the previous form page are not
>> reflected on the update).  Is the issue that I need to change all the
>> post parameters to args for a get and do a redirect? 
>>
>
> I tried it (changing post to get, that is).  Fixed the problem.

If you're using mp2, that shouldn't be necessary. If you
are, can you be more specific about the problem?  Also, which
version of Apache::Request are you using?

-- 
Joe Schaefer


Re: Auth handler and Registry scripts

Posted by Sean Davis <sd...@mail.nih.gov>.
On Jan 19, 2005, at 10:11 AM, Sean Davis wrote:

> This is a simple not-understanding-the-issues question, I'm sure.  I 
> have an authen handler (that used Apache::Request, Apache::Cookie, and 
> Apache::Session) in front of a uri serving a Registry script that runs 
> using CGI.  The script works fine without the handler in place, but 
> when I put the handler in place (which also seems to do what I want), 
> I seem to be losing the ability to do post requests (I get the 
> content, but the changes made on the previous form page are not 
> reflected on the update).  Is the issue that I need to change all the 
> post parameters to args for a get and do a redirect?
>

I tried it (changing post to get, that is).  Fixed the problem.

Sorry to waste the list's time.

Sean