Message405198
## Context ##
* Python is executing a script on behalf of a web server (e.g. Apache httpd) following the CGI protocol.
* cgitb is enabled and configured to use the 'text' format.
* An unhandled exception occurs before any CGI response headers have been emitted.
## Expected behaviour ##
A valid response is returned from the CGI script to the web server and ultimately to the client.
## Observed behaviour ##
The response is rejected by the web server because it does not begin with a valid CGI header block.
[cgi:error] [pid xxxxx] [client xxx.xxx.xxx.xxx:xxxxx] malformed header from script 'web.py': Bad header: <p>A problem occurred in a Pyt
Any traceback info included (if display=1) gets discarded and the web server returns its own Internal Server Error response instead.
## Comments ##
A valid response is observed if format='html'. This bug only concerns format='text'.
The behaviour is the same regardless of whether display=0 or display=1.
I imagine this is because cgitb.reset (which emits the headers) is only called when format='html'.
We could resolve this by always calling cgitb.reset regardless of the format, or by introducing separate text-format and HTML-format versions of cgitb.reset.
I'm happy to prepare a patch if you agree on the approach. |
|
Date |
User |
Action |
Args |
2021-10-28 16:47:19 | kierdavis | set | recipients:
+ kierdavis |
2021-10-28 16:47:19 | kierdavis | set | messageid: <1635439639.23.0.69927337911.issue45650@roundup.psfhosted.org> |
2021-10-28 16:47:19 | kierdavis | link | issue45650 messages |
2021-10-28 16:47:19 | kierdavis | create | |
|