(req)
| 140 | |
| 141 | |
| 142 | def handler(req): |
| 143 | from mod_python import apache |
| 144 | try: |
| 145 | global _isSetUp |
| 146 | if not _isSetUp: |
| 147 | setup(req) |
| 148 | _isSetUp = True |
| 149 | |
| 150 | # Obtain a Request object from CherryPy |
| 151 | local = req.connection.local_addr |
| 152 | local = httputil.Host( |
| 153 | local[0], local[1], req.connection.local_host or '') |
| 154 | remote = req.connection.remote_addr |
| 155 | remote = httputil.Host( |
| 156 | remote[0], remote[1], req.connection.remote_host or '') |
| 157 | |
| 158 | scheme = req.parsed_uri[0] or 'http' |
| 159 | req.get_basic_auth_pw() |
| 160 | |
| 161 | try: |
| 162 | # apache.mpm_query only became available in mod_python 3.1 |
| 163 | q = apache.mpm_query |
| 164 | threaded = q(apache.AP_MPMQ_IS_THREADED) |
| 165 | forked = q(apache.AP_MPMQ_IS_FORKED) |
| 166 | except AttributeError: |
| 167 | bad_value = ("You must provide a PythonOption '%s', " |
| 168 | "either 'on' or 'off', when running a version " |
| 169 | 'of mod_python < 3.1') |
| 170 | |
| 171 | options = req.get_options() |
| 172 | |
| 173 | threaded = options.get('multithread', '').lower() |
| 174 | if threaded == 'on': |
| 175 | threaded = True |
| 176 | elif threaded == 'off': |
| 177 | threaded = False |
| 178 | else: |
| 179 | raise ValueError(bad_value % 'multithread') |
| 180 | |
| 181 | forked = options.get('multiprocess', '').lower() |
| 182 | if forked == 'on': |
| 183 | forked = True |
| 184 | elif forked == 'off': |
| 185 | forked = False |
| 186 | else: |
| 187 | raise ValueError(bad_value % 'multiprocess') |
| 188 | |
| 189 | sn = cherrypy.tree.script_name(req.uri or '/') |
| 190 | if sn is None: |
| 191 | send_response(req, '404 Not Found', [], '') |
| 192 | else: |
| 193 | app = cherrypy.tree.apps[sn] |
| 194 | method = req.method |
| 195 | path = req.uri |
| 196 | qs = req.args or '' |
| 197 | reqproto = req.protocol |
| 198 | headers = list(req.headers_in.copy().items()) |
| 199 | rfile = _ReadOnlyRequest(req) |
searching dependent graphs…