Issue #423 resolved

[patch] sessionfilter fix for when _cphttptools raises an exception in processHeaders()

created an issue

When processHeaders() in _cphttptools.Request raises an exception, the sessionfilter causes a 500 error by trying to access cpy.request._session, which doesn't exist until its before_request_body() method is called. This error occurs regardless of whether the sessionfilter is enabled.

Example: {{{

telnet localhost 8080 Trying Connected to localhost. Escape character is '^]'. get / http/1.2

http/1.2 500 Internal error Date: Thu, 29 Dec 2005 04:30:25 GMT Server: CherryPy/2.2.0-beta Content-Length: 1358 Content-Type: text/html <snip /> Traceback: File "/blah/cherrypy/trunk/cherrypy/", line 110, in _run applyFilters('before_finalize') File "/blah/cherrypy/trunk/cherrypy/filters/", line 130, in applyFilters method() File "/blah/cherrypy/trunk/cherrypy/filters/", line 205, in before_finalize sess = cherrypy.request._session File "/blah/cherrypy/trunk/cherrypy/", line 34, in getattr return getattr(childobject, name) AttributeError: 'Request' object has no attribute '_session' }}}

Fix: {{{ delete line "cherrypy.request._session = EmptyClass()" from the before_request_body() method in

add the following lines to the SessionFilter class in def on_start_resource(self): cherrypy.request._session = EmptyClass() }}}

Comments (2)

  1. Log in to comment