[mod_python] Problem with Session module with multiple scriptalias not under t he document root

Gregory (Grisha) Trubetskoy grisha at modpython.org
Wed Nov 26 16:03:21 EST 2003


You should start addressing this by removing all reference to CGI. You
don't need (and shouldn't use) any ScriptAlias directives to make
mod_python work, since it has nothing to do with CGI at all.

Once all your directories containing Python code are under DocumentRoot, I
think it will work correctly.

Grisha

On Wed, 26 Nov 2003, Manera, Villiam wrote:

> First of all my configuration<?xml:namespace prefix = o ns =
> "urn:schemas-microsoft-com:office:office" />
>
>
>
> >From httpd.conf:
>
> .....
>
>     DocumentRoot "E:/wwwroot/cartelle_sito_mdn"
>
> ....
>
>     ScriptAlias /cgi-mpy/ "E:/script/cgi/cgi-mpy/"
>
>     ScriptAlias /produzione/ "E:/script/cgi/produzione/"
>
>     ScriptAlias /organizzazione/ "E:/script/cgi/organizzazione/"
>
> .........
>
>     <Directory "E:/script/cgi/cgi-mpy">
>
> ...
>
>                 AddHandler python-program .py
>
>                 PythonHandler mod_python.publisher
>
>             PythonPath ....
>
>                 PythonDebug on
>
>                   #PythonOption ApplicationPath /cgi-mpy
>
>                PythonOption SessionDbm
> 'E:/wwwroot/dati_autenticazione/sid/session.dbm'
>
>    </Directory>
>
>
>
> if I miss PythonOption ApplicationPath ... in any directory:
>
>
>
>     def make_cookie(self):
>
>             ....
>
>         if config.has_key("ApplicationPath"):
>
>             c.path = config["ApplicationPath"]
>
>         else:
>
>             docroot = self._req.document_root()
>
>             # the path where *Handler directive was specified
>
>             dirpath = self._req.hlist.directory
>
>             c.path = dirpath[len(docroot):]
>
>
>
> so the req.headers_out generate this html heading for cgi-mpy scriptalias:
>
> {'Set-Cookie': 'pysid=596d8102cb1dcbf389117fb7d6a497ba; path=',
> 'Cache-Control': 'nocache="set-cookie"'}
>
>
>
> where path=  because len(document root) :28 len (dirpath) 21
>
>
>
> and in this way all work fine for all my scriptalias except for
>
>  ScriptAlias /organizzazione/ "E:/script/cgi/organizzazione/"
>
> In this case len(dirpath) = 30 so path='/\'
>
> And I make the first connection under this path any attempt to call url
> under other scriptalias cause a new session because the hader miss the key
> 'Set-Cookie'....
>
>
>
> So I tryed to use:
>
> PythonOption ApplicationPath /cgi-mpy
>
> PythonOption ApplicationPath /organizzazione
>
> ....
>
> If my first connection is under cgi-mpy all work fine for all the url under
> cgi-mpy, but any attempt to connect to un url under a different scriptalias
> cause a new session
>
>
>
> So I may choose to change orgenizzazione in organiz, or to modify the
> session module: c.path=''
>
> Any other suggestion?
>
>
>
> Villiam Manera
> Dirett.  Sistema Informativo
>
> Manifatture del Nord srl
> viale Regina Elena 13-15
> 42100 Reggio Emilia RE
> ITALY
>
> Tel. +39 0522 508200
> Fax +39 0522 514099
> email : vmanera at manord.com
> www.pennyblack.com
>
>
>


More information about the Mod_python mailing list