04-17-07 12:12 PM
[ https://issues.apache.org/jira/brow...ls:all-tabpanel ]
Graham Dumpleton closed MODPYTHON-167.
--------------------------------------
> If PythonDebug is On and error occurs, status is 200 when it should really
be 500.
> --------------------------------------------------------------------------
--------
>
> Key: MODPYTHON-167
> URL: https://issues.apache.org/jira/browse/MODPYTHON-167
> Project: mod_python
> Issue Type: Bug
> Components: core
> Affects Versions: 3.1.4, 3.2.8
> Reporter: Graham Dumpleton
> Assigned To: Graham Dumpleton
> Fix For: 3.3
>
>
> If PythonDebug is Off and an uncaught exception occurs in Python, the details of t
hat exception will be logged in the Apache error log file. At the same time a 500 (H
TTP_INTERNAL_SERVER_ERROR) response is returned to the client with whatever the conf
igu
red default 500 error response message is for Apache.
> If PythonDebug is On, the details are still logged to the error log, but the detai
ls of the exception will also be formatted and returned in the response to the clien
t. In returning this response though, the HTTP status code is being returned as 200
(HT
TP_OK) rather than the more correct 500 (HTTP_INTERNAL_SERVER_ERROR).
> By wrongly returning 200 rather than 500, one could theoretically run up against p
roblems like the response being cached, or if client was a non interactive applicati
on, it may think it was an entirely valid response and not flag in some way that it
was
actually an error.
> The change to fix this in the code are as details in following patch. Note that re
turning 500 will still result in the message being displayed in a web browser, so fo
r its intended purpose of displaying a traceback to a client, it will still work as
req
uired.
> Index: lib/python/mod_python/apache.py
> ========================================
===========================
> --- lib/python/mod_python/apache.py (revision 396453)
> +++ lib/python/mod_python/apache.py (working copy)
> @@ -533,6 +533,7 @@
> return HTTP_INTERNAL_SERVER_ERROR
> else:
> # write to client
> + req.status = HTTP_INTERNAL_SERVER_ERROR
> req.content_type = 'text/html'
>
> s = '\n<pre>\nMod_python error: "%s %s"\n\n' % (phase, hname)
[ Post a follow-up to this message ]
|