This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: BaseHTTPServer hard-codes Content-Type for error messages
Type: behavior Stage:
Components: Library (Lib) Versions: Python 2.6
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: ajaksu2, georg.brandl, gvanrossum, samwyse, vila
Priority: low Keywords: easy

Created on 2007-11-23 13:04 by samwyse, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
BaseHTTP_error_content_type.diff ajaksu2, 2008-02-23 14:31 Adds DEFAULT_ERROR_TYPE and .error_content_type
Messages (5)
msg57784 - (view) Author: Samwyse (samwyse) * Date: 2007-11-23 13:04
The send_error method always sends a Content-Type of 'text/html'.  Other
content types are both possible and desirable.  For example, someone
writing a REST server might wish to send XML error messages.  Following
the example of DEFAULT_ERROR_MESSAGE, I propose adding the following in
the appropriate places:

91a92,94
> # Default error content-type
> DEFAULT_ERROR_TYPE = 'text/html'
>
345c348
<         self.send_header("Content-Type", "text/html")
---
>         self.send_header("Content-Type", error_message_type)
351a355
>     error_message_type = DEFAULT_ERROR_TYPE
msg57858 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2007-11-26 22:08
I'm okay with adding this to 2.6 (and hence 3.0) but not with doing this
to 2.5.
msg59343 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2008-01-06 00:05
Something for the bug day on Jan 19?
msg62733 - (view) Author: Daniel Diniz (ajaksu2) * (Python triager) Date: 2008-02-23 14:31
Here's my attempted patch against trunk. The doc is poor (but what else
should it contain?)  and the attribute name could be better. 

I'm worried about lack of testing for this change as the module has
virtually no tests. Should we start adding naive (regarding buildbots)
tests?
msg62737 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008-02-23 15:02
Reviewed and committed in r60980. Thanks!
History
Date User Action Args
2022-04-11 14:56:28adminsetgithub: 45833
2008-02-23 15:02:41georg.brandlsetstatus: open -> closed
assignee: georg.brandl
messages: + msg62737
nosy: + georg.brandl
2008-02-23 14:31:07ajaksu2setfiles: + BaseHTTP_error_content_type.diff
nosy: + ajaksu2
messages: + msg62733
2008-01-12 14:00:10georg.brandlsetkeywords: + easy
2008-01-06 00:05:08gvanrossumsetmessages: + msg59343
2008-01-05 15:07:12vilasetnosy: + vila
2007-11-26 22:08:16gvanrossumsetpriority: low
resolution: accepted
messages: + msg57858
nosy: + gvanrossum
versions: - Python 2.5, Python 2.4, Python 3.0
2007-11-23 13:04:32samwysesettype: behavior
components: + Library (Lib)
versions: + Python 2.6, Python 2.5, Python 2.4, Python 3.0
2007-11-23 13:04:07samwysecreate