[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cgiapp] CAP::Apache and CAP::Session


Cees Hek wrote:
On Wed, 10 Nov 2004 12:04:53 -0500, Michael <suppressed> wrote:

Problem:

I have upgraded an application to use CGI::Application::Plugin::Apache
which, if you haven't seen changes you app to use Apache::* modules
instead of CGI.pm. I also wanted to use the
CGI::Application::Plugin::Session module as well since it's easy to use
and clean. But it uses the CGI.pm cookie() method to generate the cookie
to glean the session id and to create a new cookie for the headers.
>
CAP::Session has a mechanism to handle this situation (although it is
probably not desirable in most situations).  It will allow you to
manage the cookie yourself...  By passing SEND_COOKIE => 0 to
session_config, CAP::Session will not send the cookie header out, and
leaves cookie management to the developer.

Yeah, not really desireable. It's just one step away from using CGI::Session directly.

As for handling the Apache problem within CAP::Session, I don't want
to add conditions for ever type of cookie management to the code.  I
think that could get messy very quickly.  Besides, it is not possible
to automatically detect what the user is using to send the headers. Even if the $self->query object returns an Apache::Request object, it
is possible (though unlikely) that the user is still using CGI.pm to
send the headers somewhere else in the code.

Agreed.


As for checking for $ENV{MOD_PERL}, I use Apache::Registry for a lot
of my scripts, but still use CGI.pm for parameter handling and sending
headers, so I don't think that will work either.

Using CGI::Cookie directly is probably the best compomise.

I also agree with this since CGI.pm actually uses CGI::Cookie and it works in vanilla cgi and mod_perl.

I have not had a chance to closely look at the CAP::Apache module yet.
 Can the cookie still be sent to header_add successfully?  Or does the
cookie need to be baked into the Apache::Request object?

No, CAP::Apache goes out of it's way to make sure that header_add() and header_props() still work. In fact if you look at the CAP::Apache docs there's an example of doing just that.


Either way should work and it would even help those who use other non
CGI.pm query objects (like CGI::Simple, etc)
>
Actually, CGI::Simple does have a cookie method so it should work
fine.  However CGI::Minimal will not work, since it doesn't have a
cookie method...  There are probably other CGI like modules that won't
work either.

Well, my vote is for using header_add and CGI::Cookie, since that's what you are doing indirectly anyway, right?

--
Michael Peters
Developer
Plus Three, LP


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/suppressed/
             http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.