On Wed, 22 Jan 2003 22:21:20 -0700
"Joseph P. Crotty" <[EMAIL PROTECTED]> wrote:

> Here is the simplest form of the problem I can produce.
> 
> I have two handlers and want to pass some info between them visa vi pnotes.  One
> is a PerlTransHandler for Apache::SessionManager and the other is a PerlHandler
> for a simple Hello.pm that dumps some html with the current _session_start value
> (i.e. from pnotes).  Apache::SessionManager checks to see if a session file
> exists, creates one if not, and updates pnotes appropriately.
> 
> The problem - if I request index.html there is no value in pnotes for
> _session_start as confirmed by Hello.pm.  

Hi Joseph,
I have a little question. You request:

        http://yourserver.com

or:

        http://yourserver.com/index.html

?

Note that in first case Apache can do an internal subrequest to 
file(s) defined by the DirectoryIndex directive.
Currently, Apache::SessionManager skips all subrequests.
Otherwise, the second URL works fine.

>It seems that there is nothing in
> pnotes period.  If after the request I manually inspect the session file created
> I find a value for _session_start.  Request other pages (e.g. test.html) and
> there are expected pnotes entries confirmed by Hello.pm.
> 

For the URI ending with a slash, you can this workaround by putting this line 
in your http.conf:

        RedirectMatch (.*)/$ $1/index.html

> Apache 1.3.27 mod_perl
> 
> <httpd.conf snippet>
> #START mod_perl Configuration
> #----------------------------
> PerlRequire conf/startup.pl
> PerlSetEnv  MOD_PERL_TRACE all
> 
> PerlSetEnv  SERVER_ROOT /usr/local/apache/
> #--------------------------
> #END mod_perl Configuration
> 
> 
> #START Apache::SessionManager Configuration
> #------------------------------------------
> PerlModule Apache::SessionManager
> PerlTransHandler Apache::SessionManager
> #----------------------------------------
> #END Apache::SessionManager Configuration
> 
> 
> #START Block Directives
> #----------------------
> <Location />
>     SetHandler perl-script
>     PerlSetVar SessionManagerDebug 0
>     PerlSetVar SessionManagerTracking On
>     PerlSetVar SessionManagerExpire 3600
>     PerlSetVar SessionManagerStore File
>     PerlSetVar SessionManagerStoreArgs "Directory     =>
> /usr/local/apache/session, \
>                                         LockDirectory =>
> /usr/local/apache/session/lock"
> </Location>
> 
> <Directory "/usr/local/apache/htdocs">
>     <Files ~ "index.html$">
>         SetHandler perl-script
>         PerlHandler MyApache::Hello
>     </Files>
> 
>     <Files ~ "test.html$">
>         SetHandler perl-script
>         PerlHandler MyApache::Hello
>     </Files>
> </Directory>
> 

Your configuration seems to be bizarre...! ;-)
As I have answered to you in a previous personal post, if you want to use 
Apache::SessionManager with the <Directory> directives (and you do not want 
to put the PerlSetVar SessionManager* directives in httpd.conf's global scope,
of course), you can install it in the header_parser phase by putting a line like
this:

        PerlHeaderParserHandler Apache::SessionManager

in global, <VirtualHost>, <Directory>, <Location>, .htaccess sections of your 
httpd.conf file. For example:

---CUT HERE---
PerlModule Apache::SessionManager 
<Directory /usr/local/apache/htdocs>
   <FilesMatch "\.html$">
      SetHandler perl-script
      PerlHandler MyApache::Hello

      PerlHeaderParserHandler Apache::SessionManager
      PerlSetVar SessionManagerTracking On
      PerlSetVar SessionManagerExpire 3600
      PerlSetVar SessionManagerInactivity 900
      PerlSetVar SessionManagerName MYPELRSESSIONID
      PerlSetVar SessionManagerStore File
      PerlSetVar SessionManagerStoreArgs "Directory => /tmp/apache_session_data/"
      PerlSetVar SessionManagerDebug 5
   </FilesMatch>
</Directory>  
---CUT HERE---

If you need session URI tracking, you must accept the compromise...:
the PerlTransHandler phase with <Location> directive. This is a configuration
example to run all the /cgi-bin executable scripts over Apache::Registry
with session ID URI rewriting:

---CUT HERE---
PerlModule Apache::SessionManager
PerlTransHandler Apache::SessionManager
Alias /perl/  /usr/local/apache/cgi-bin/
<LocationMatch "^/([0-9a-h]+/)?perl">
   SetHandler perl-script
   PerlHandler Apache::Registry
   PerlSendHeader On
   PerlSetupEnv   On
   Options ExecCGI
 
   PerlSetVar SessionManagerTracking On
   PerlSetVar SessionManagerURITracking On
   PerlSetVar SessionManagerExpire 3600
   PerlSetVar SessionManagerInactivity 1800
   PerlSetVar SessionManagerName MYPELRSESSIONID
   PerlSetVar SessionManagerStore File
   PerlSetVar SessionManagerStoreArgs "Directory => /tmp/apache_session_data/"
   PerlSetVar SessionManagerDebug 5
</LocationMatch>
---CUT HERE---


by

        - Enrico

Reply via email to