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: http.server error message format
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.2, Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: orsenthil Nosy List: eric.araujo, ezio.melotti, gennad, ivanrdg, orsenthil, python-dev
Priority: normal Keywords: patch

Created on 2011-03-16 03:36 by ivanrdg, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
11567.patch gennad, 2011-03-17 06:45 Sets global variable DEFAULT_ERROR_MESSAGE on the module http.server to W3C standard value and improves wording a bit review
Messages (11)
msg131086 - (view) Author: Ivan Radigales Creus (ivanrdg) Date: 2011-03-16 03:36
The global variable DEFAULT_ERROR_MESSAGE on the module http.server is set to a non W3C standard value.

It would be better to use something like:

DEFAULT_ERROR_MESSAGE = """\
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
		<title>Error response</title>
	</head>
	<body>
		<h1>Error response</h1>
		<p>Error code %(code)d.</p>
		<p>Message: %(message)s.</p>
		<p>Error code explanation: %(code)s = %(explain)s.</p>
	</body>
</html>
"""

That follows the W3C standards and validates successful on the http://validator.w3.org

Thanks!
msg131219 - (view) Author: Gennadiy Zlobin (gennad) * Date: 2011-03-17 04:48
I take this issue
msg131220 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2011-03-17 04:50
go ahead. please submit a patch.
msg131227 - (view) Author: Gennadiy Zlobin (gennad) * Date: 2011-03-17 06:45
Hi guys, this is my first patch for the Python interpreter.
Hope it is ok, but if it is not, be sure to comment and I'll fix it ASAP
msg131236 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-03-17 08:48
New changeset db4967095f10 by Senthil Kumaran in branch '3.2':
Fix issue11567: http.server DEFAULT_ERROR_MESSAGE format. Patch by Gennadiy Zlobin.
http://hg.python.org/cpython/rev/db4967095f10
msg131237 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2011-03-17 08:50
Fixed in 3.3 and 3.2.
msg131313 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2011-03-18 02:52
This is just nitpicking, but serving XHTML as text/html is wrong.  Also  XHTML is not necessary here, so I would just use an HTML 4.01 strict doctype (and remove the xmlns).
msg131465 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-03-20 00:23
I agree with Ezio.  I noticed the commit but didn’t comment: I wanted to bring up the subject of HTML-producing modules in the stdlib and advocate use of HTML 5 (for real, pragmatic reasons, not because of a mode effect—I’ll dig up a number of links that explain the problems with pseudo-XHTML).
msg131467 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2011-03-20 02:35
Ezio Melotti wrote:

> This is just nitpicking, but serving XHTML as text/html is wrong.  

While, I thought this statement is correct and expected the Internet
media-type should be something else (application/xhtml+xml), but as
per w3c, it is not wrong to serve XHTML as text/html (RFC 3236)

Also, have a look at the example given at:

http://www.w3.org/QA/2002/04/Web-Quality

Validating the present output using the validator will give a green
signal too.

>Also  XHTML is not necessary here, so I would just use an HTML 4.01
>strict doctype (and remove the xmlns).

Agree to this. Although at the moment it does not cause any harm, it
is a good to be plain HTML when it is a http server.

Éric - HTML5 is not a standard yet and when it becomes one (or much
earlier, when it becomes a de-facto standard), then html producing
stdlib modules should move to it. I don't think we should move faster
than browsers or html client applications.
msg131470 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-03-20 02:45
New changeset 135a0d7bc4db by Senthil Kumaran in branch '3.1':
Issue #11567 - Let's have the DOCTYPE as HTML instead of XHTML.
http://hg.python.org/cpython/rev/135a0d7bc4db
msg131509 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-03-20 16:37
Well, it is possible to disagree with the W3C on that particular point :)

http://hixie.ch/advocacy/xhtml
http://www.xml.com/pub/a/2004/07/21/dive.html
http://www.cs.tut.fi/~jkorpela/html/empty.html
http://diveintomark.org/archives/2004/01/14/thought_experiment
History
Date User Action Args
2022-04-11 14:57:14adminsetgithub: 55776
2011-03-20 16:37:48eric.araujosetnosy: orsenthil, ezio.melotti, eric.araujo, python-dev, gennad, ivanrdg
messages: + msg131509
2011-03-20 02:45:56python-devsetnosy: orsenthil, ezio.melotti, eric.araujo, python-dev, gennad, ivanrdg
messages: + msg131470
2011-03-20 02:35:17orsenthilsetnosy: orsenthil, ezio.melotti, eric.araujo, python-dev, gennad, ivanrdg
messages: + msg131467
2011-03-20 00:23:42eric.araujosetnosy: orsenthil, ezio.melotti, eric.araujo, python-dev, gennad, ivanrdg
messages: + msg131465
2011-03-19 20:54:18ezio.melottisetnosy: + eric.araujo
2011-03-18 02:52:44ezio.melottisetnosy: + ezio.melotti
messages: + msg131313
2011-03-17 08:50:11orsenthilsetstatus: open -> closed

messages: + msg131237
resolution: fixed
nosy: orsenthil, python-dev, gennad, ivanrdg
2011-03-17 08:48:39python-devsetnosy: + python-dev
messages: + msg131236
2011-03-17 06:45:16gennadsetfiles: + 11567.patch

messages: + msg131227
keywords: + patch
nosy: orsenthil, gennad, ivanrdg
2011-03-17 04:50:52orsenthilsetversions: + Python 3.3
nosy: + orsenthil

messages: + msg131220

assignee: orsenthil
type: performance -> behavior
2011-03-17 04:48:31gennadsetnosy: + gennad
messages: + msg131219
2011-03-16 03:36:55ivanrdgcreate