Opened 11 years ago

Closed 11 years ago

#2073 enhancement closed duplicate (duplicate)

Access to twisted request object in WSGI applications

Reported by: martinpaljak Owned by:
Priority: normal Milestone:
Component: web2 Keywords:
Cc: Branch:
Author:

Description

It is generally useful to have access to the request object in WSGI applications. I propose the following patch to achieve this:

Index: twisted/web2/wsgi.py
===================================================================
--- twisted/web2/wsgi.py        (revision 18085)
+++ twisted/web2/wsgi.py        (working copy)
@@ -112,6 +112,7 @@
         env['wsgi.multiprocess'] = False
         env['wsgi.run_once']     = False
         env['wsgi.file_wrapper'] = FileWrapper
+        env['twisted.request']   = request 
         self.environment = env
         
     def startWSGIResponse(self, status, response_headers, exc_info=None):

My case: I need access to the transport (M2crypto SSL wrapper) to renegotiate the smart card authenticated SSL channel upon clicking 'logout' in webapp. This triggers a new certificate selection and also PIN entry. Current WSGI implementation hides the request/context objects from WSGI apps that normally is available in render(HTTP) methods.

Change History (2)

comment:1 Changed 11 years ago by martinpaljak

Resolution: duplicate
Status: newclosed

comment:2 Changed 7 years ago by <automation>

Owner: jknight deleted
Note: See TracTickets for help on using tickets.