Issue Details (XML | Word | Printable)

Key: MODPYTHON-86
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Jim Gallacher
Reporter: Jim Gallacher
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
mod_python

Multiple session cookies created when ApplicationPath is set to /

Created: 28/Oct/05 04:51 AM   Updated: 05/Mar/06 02:37 PM
Return to search
Component/s: None
Affects Version/s: 3.2.7
Fix Version/s: 3.2.7

Time Tracking:
Not Specified

Environment: mod_python-3.2.2b.win32-py2.4.exe

Resolution Date: 29/Oct/05 01:25 AM


 Description  « Hide
Originally reported by Villiam Manera on mod_python list.

"""
Apache configuration --> PythonOption ApplicationPath '/'

Before the beta there was only a cookie: pysid with path = '/'

With the beta in place there are many pysid with different path,seems one each module I call, example:

Pysyd: e81c661b3c9d11948a3b643c4c031695855e254a61239279086ef1bb8916c10c path:/
Pysid: 855e254a61239279086ef1bb8916c10c path: /cgi-mpy/cgi_mpy_utentis.py/
Pysyd: 855e254a61239279086ef1bb8916c10c path: /cgi-mpy/cgi-mpy_menu.py/
Pysyd: 855e254a61239279086ef1bb8916c10c path: /comm/comm_menu.py/
Pysyd: 855e254a61239279086ef1bb8916c10c path: /pf/pf_magauto.py/ ......
"""

Villiam traced the problem to the following code in Session.py

class BaseSession(dict):
.........
        if self._sid:
            # attempt to load ourselves
            self.lock()
            if self.load():
                self._new = 0
                if not req.headers_out.has_key("Set-Cookie"):
                    Cookie.add_cookie(self._req, Cookie.Cookie(session_cookie_name, self._sid))

The last two lines were added to 3.2 to support some new session handling functionality. For various reasons that new functionality has been deferred until 3.3, but the new code was not removed. That should not be a problem, except that it is both buggy and wrong. :-(

The correct fix for the 3.2.x release is to remove those 2 lines.

         if self._sid:
             # attempt to load ourselves
             self.lock()
             if self.load():
                 self._new = 0
                 #if not cookies.has_key(session_cookie_name):
                 # Cookie.add_cookie(self._req, self.make_cookie())





 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Repository Revision Date User Message
ASF #329236 Fri Oct 28 16:20:52 UTC 2005 jgallacher Fixed problem in BaseSession.__init__ which was causing multiple session
cookies to be set.
Ref MODPYTHON-86
Files Changed
MODIFY /httpd/mod_python/trunk/lib/python/mod_python/Session.py