Matt Good avatar Matt Good committed 6bf7f17

follow up [2409] to ignore blank `trac.htdocs_location` values and default to the built-in chrome handler

Comments (0)

Files changed (2)

trac/web/chrome.py

 
         href = Href(req.cgi_location)
         req.hdf['chrome.href'] = href.chrome()
-        htdocs_location = self.config.get('trac', 'htdocs_location',
-                                          href.chrome('common'))
+        htdocs_location = self.config.get('trac', 'htdocs_location') or \
+                          href.chrome('common')
         req.hdf['htdocs_location'] = htdocs_location.rstrip('/') + '/'
 
         # HTML <head> links

trac/web/fcgi_frontend.py

 from trac.web.main import dispatch_request, get_environment, \
                           send_pretty_error, send_project_index
 
-import _fcgi
+import _thfcgi
+#import _fcgi
 import os
 import locale
 
 def run():
     locale.setlocale(locale.LC_ALL, '')
-    _fcgi.Server(_handler).run()
+    _thfcgi.THFCGI(_handler).run()
+    #_fcgi.Server(_handler).run()
 
+class FCGIRequest(CGIRequest):
+    def __init__(self, environ, input, output, fieldStorage):
+        self._fieldStorage = fieldStorage
+        CGIRequest.__init__(self, environ, input, output)
 
-def _handler(_req):
-    req = CGIRequest(_req.params, _req.stdin, _req.stdout)
+    def _getFieldStorage(self):
+        return self._fieldStorage
+
+
+def _handler(_req, _env, _fieldStorage):
+    req = FCGIRequest(_env, _req.stdin, _req.out, _fieldStorage)
     env = get_environment(req, os.environ)
 
     if not env:
         send_project_index(req, os.environ)
-        return _fcgi.CGI_REQUEST_COMPLETE, 0
+        return
 
     try:  
         dispatch_request(req.path_info, req, env)
     except Exception, e:
         send_pretty_error(e, env, req)
-    return _fcgi.FCGI_REQUEST_COMPLETE, 0
+    return
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.