[issue45650] cgitb does not emit CGI headers when format='text'

2021-12-11 Thread Eric V. Smith


Eric V. Smith  added the comment:

Having not heard back about a use case for this, I'm going to close it. If you 
want to move this forward, I suggest proposing it on the python-ideas mailing 
list.

--
resolution:  -> rejected
stage:  -> resolved
status: pending -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45650] cgitb does not emit CGI headers when format='text'

2021-11-14 Thread Eric V. Smith


Change by Eric V. Smith :


--
status: open -> pending

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45650] cgitb does not emit CGI headers when format='text'

2021-11-14 Thread Eric V. Smith


Eric V. Smith  added the comment:

I would think the use case for 'text' is to not print the output to a web page, 
so you wouldn't want the headers. The documentation says that cgitb was 
generalized to not only produce output for web pages. The 'text' format 
provides this generalization.

Changing to an enhancement request for 3.11. We can't change the 'text' format 
because it would break existing code. so this is really an enhancement request 
for a new format. But I don't see what the use case would be, so I don't think 
it would be accepted.

What's the case where you need this functionality? How is the 'html' format 
unacceptable?

--
nosy: +eric.smith
type: behavior -> enhancement
versions:  -Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45650] cgitb does not emit CGI headers when format='text'

2021-10-28 Thread Kier Davis


New submission from Kier Davis :

## 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 x] [client xxx.xxx.xxx.xxx:x] malformed header 
from script 'web.py': Bad header: 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.

--
components: Library (Lib)
files: repro_cgitb_not_emitting_headers_in_text_mode.py
messages: 405198
nosy: kierdavis
priority: normal
severity: normal
status: open
title: cgitb does not emit CGI headers when format='text'
type: behavior
versions: Python 3.10, Python 3.11, Python 3.6, Python 3.7, Python 3.8, Python 
3.9
Added file: 
https://bugs.python.org/file50409/repro_cgitb_not_emitting_headers_in_text_mode.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com