[CherryPy] #779: Conflict with sessions and basic/digest auth tools

6 views
Skip to first unread message

CherryPy

unread,
Jan 28, 2008, 8:35:19 AM1/28/08
to cherrypy...@googlegroups.com
#779: Conflict with sessions and basic/digest auth tools
---------------------------+------------------------------------------------
Reporter: dowski | Owner: dowski
Type: defect | Status: new
Priority: normal | Milestone: 3.1
Component: CherryPy code | Keywords:
---------------------------+------------------------------------------------
It looks like there is a problem with using the session and
(basic|digest)_auth tools together. This was originally reported on IRC
by !StoneKeeper. Attached is a sample program that demonstrates the
problem. Here is the traceback:

{{{
Traceback (most recent call last):
File "/usr/lib/python2.4/site-
packages/CherryPy-3.0.2-py2.4.egg/cherrypy/_cpengine.py", line 244, in
release
req.close()
File "/usr/lib/python2.4/site-
packages/CherryPy-3.0.2-py2.4.egg/cherrypy/_cprequest.py", line 424, in
close
self.hooks.run('on_end_request')
File "/usr/lib/python2.4/site-
packages/CherryPy-3.0.2-py2.4.egg/cherrypy/_cprequest.py", line 90, in run
hook()
File "/usr/lib/python2.4/site-
packages/CherryPy-3.0.2-py2.4.egg/cherrypy/_cprequest.py", line 58, in
__call__
return self.callback(**self.kwargs)
File "/usr/lib/python2.4/site-
packages/CherryPy-3.0.2-py2.4.egg/cherrypy/lib/sessions.py", line 418, in
close
if sess.locked:
File "/usr/lib/python2.4/site-
packages/CherryPy-3.0.2-py2.4.egg/cherrypy/__init__.py", line 234, in
__getattr__
child = getattr(serving, self.__attrname__)
AttributeError: '_Serving' object has no attribute 'session'
}}}

--
Ticket URL: <http://cherrypy.org/ticket/779>
CherryPy <http://www.cherrypy.org>
CherryPy - a pythonic, object-oriented HTTP framework

CherryPy

unread,
Feb 21, 2008, 1:43:45 PM2/21/08
to cherrypy...@googlegroups.com
#779: Conflict with sessions and basic/digest auth tools
---------------------------+------------------------------------------------
Reporter: dowski | Owner: dowski
Type: defect | Status: new
Priority: normal | Milestone: 3.1
Component: CherryPy code | Resolution:
Keywords: |
---------------------------+------------------------------------------------
Comment (by guest):

Problem is with auth raising 401, because then before_request_body hooks
are not run and thus session is not initialized.

Fix for me with existing version is hacky:
{{{
cherrypy.tools.later_digest_auth = cherrypy.Tool('before_handler',
digest_auth, priority=60)
}}}

Real fix would mean either not calling session hooks if hooks wasn't
initialized, or checking for hasattr(cherrypy, 'session') in save/etc
session hooks.

Or something more robust and less straightforward :)

--
Ticket URL: <http://www.cherrypy.org/ticket/779>

CherryPy

unread,
Mar 14, 2008, 11:35:34 AM3/14/08
to cherrypy...@googlegroups.com
#779: Conflict with sessions and basic/digest auth tools
---------------------------+------------------------------------------------
Reporter: dowski | Owner: dowski
Type: defect | Status: new
Priority: normal | Milestone: 3.1
Component: CherryPy code | Resolution:
Keywords: |
---------------------------+------------------------------------------------
Comment (by fumanchu):

I can't seem to reproduce this either in HEAD or r1900. Can you verify
it's been fixed or is invalid?

CherryPy

unread,
Apr 26, 2008, 9:00:00 PM4/26/08
to cherrypy...@googlegroups.com
#779: Conflict with sessions and basic/digest auth tools
----------------------+-----------------------------------------------------
Reporter: dowski | Owner: dowski
Type: defect | Status: new
Priority: normal | Milestone: 3.1
Component: sessions | Resolution:
Keywords: |
----------------------+-----------------------------------------------------
Comment (by mschurter):

Attached test case works for me in r1954. (Debian Sid, Python 2.5.2)

CherryPy

unread,
Jun 29, 2008, 3:33:41 PM6/29/08
to cherrypy...@googlegroups.com
#779: Conflict with sessions and basic/digest auth tools
----------------------+-----------------------------------------------------
Reporter: dowski | Owner: dowski
Type: defect | Status: closed
Priority: normal | Milestone: 3.1
Component: sessions | Resolution: worksforme
Keywords: |
----------------------+-----------------------------------------------------
Changes (by fumanchu):

* resolution: => worksforme
* status: new => closed
Reply all
Reply to author
Forward
0 new messages