You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Dmitry Beransky <db...@ucsd.edu> on 2000/06/16 23:27:47 UTC

Apache::ASP and Apache request object

Hi,

Joshua, I guess this question is for you.

Some time ago I asked how to combine ASP's session management and 
Apache::Session.  You recommended I use Script_OnStart to set $Session to 
an instance of Apache::Session.

In order to get an instance of Apache::Session, I need to get to the 
current session id which is stored in a request header, which means I need 
to get a reference to the current apache request object.  I've browsed 
through Apache::ASP code and docs and realized that there is no documented 
API for accessing the underlying request, but I can still do it by 
accessing the internal structures directly:

    $sessionID = $self->{'asp'}->{'r'}->header_in('sessionID');

So my question is: how reliable this method is?  Can I assume that the 
structure of the ASP and GlobalASA will not change in the future?

Thanks
Dmitry

At 12:38 PM 10/7/99, Joshua Chamas wrote:
>Dmitry Beransky wrote:
> >
> > Thanks Joshua,
> >
> > Sigh, I guess I have to redesign my code.  It hadn't even occurred to me
> > that ASP's session management may not be available outside of ASP.  It's a
> > shame, though, to have use two different code bases to do essentially the
> > same task.  What would be nice if all of ASP's session stuff got moved into
> > Apache::ASP::Session which could be used from anywhere.  I think this is
> > more efficient, as: 1) the same code can be used in ASPs and perl handlers;
> > 2) memory resources are conserved by sharing session data structures; etc.
> >
>
>This is a hard problem to solve, and I'm not sure how to
>do it ... I have thought about it a couple times now, w/o
>clear resolution.
>
>The only things that the ASP $Session has that Apache::Session
>does not is the event handlers, like hooks into Session_OnStart,
>Session_OnEnd, Application_OnStart, Application_OnEnd.
>
>If you don't need these event handlers, then you could use
>Apache::Session very well for you needs, as well as ASP $Session,
>then you can turn sessions off in ASP, and set $Session
>to an Apache::Session like:
>
>sub Script_OnStart {
>         $Session = &Apache::Session::initcode;
>}
>
>Then your Apache::Session will be available in your ASP scripts
>as $Session


Re: Apache::ASP and Apache request object

Posted by Joshua Chamas <jo...@chamas.com>.
Dmitry Beransky wrote:
> 
> Hi,
>
> In order to get an instance of Apache::Session, I need to get to the
> current session id which is stored in a request header, which means I need
> to get a reference to the current apache request object.  I've browsed
> through Apache::ASP code and docs and realized that there is no documented
> API for accessing the underlying request, but I can still do it by
> accessing the internal structures directly:
> 
>     $sessionID = $self->{'asp'}->{'r'}->header_in('sessionID');
> 
> So my question is: how reliable this method is?  Can I assume that the
> structure of the ASP and GlobalASA will not change in the future?
>

You can get the current request like Apache->header_in('sessionID')
So this doesn't rely on ASP internals, you'll be fine.

--Joshua