Changeset 30
- Timestamp:
- 02/01/06 12:02:21
- Files:
-
- modpython_gateway.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
modpython_gateway.py
r23 r30 5 5 Example httpd.conf section for a CherryPy app called "mcontrol": 6 6 7 < Directory D:\htdocs\mcontrol>7 <Location /mcontrol> 8 8 SetHandler python-program 9 9 PythonHandler wsgiref.modpy_wrapper::handler 10 10 PythonOption application cherrypy.wsgiapp::wsgiApp 11 11 PythonOption import mcontrol.cherry::startup 12 </Directory> 12 </Location> 13 14 Some WSGI implementations assume that the SCRIPT_NAME environ variable will 15 always be equal to "the root URL of the app"; Apache probably won't act as 16 you expect in that case. You can add another PythonOption directive to tell 17 the modpython_gateway to force that behavior: 18 19 PythonOption SCRIPT_NAME /mcontrol 13 20 14 21 """ … … 93 100 env = dict(apache.build_cgi_env(req)) 94 101 95 if req.headers_in.has_key("authorization"): 96 env["HTTP_AUTHORIZATION"] = req.headers_in["authorization"] 102 if 'SCRIPT_NAME' in options: 103 env['SCRIPT_NAME'] = options['SCRIPT_NAME'] 104 env['PATH_INFO'] = req.uri[len(options['SCRIPT_NAME']):] 97 105 98 106 BaseCGIHandler.__init__(self, … … 105 113 ) 106 114 self.request = req 107 108 def _write(self, data): 109 try: 110 self.request.write(data) 111 except IOError, x: 112 if "client closed connection" in x.args[0]: 113 return 114 raise 115 self._write = req.write 115 116 116 117 def _flush(self):
