Issue 866222: SimpleHTTPServer docs out of date (original) (raw)

The Library documentation about SimpleHTTPServer. py is out of date:

In extensions_map: Default is signified by an empty string, and is considered to be text/plain.[...]

should read

Default is signified by an empty string, and is considered to be application/octet-stream.

In do_GET: If the request was mapped to a directory, a 403 respond is output, followed by the explanation 'Directory listing not supported'. Any IOError [...]

should read:

If the request was mapped to a directory, a file named index.html or index.htm (in that order) is searched inside it. If found, then its contents are returned; otherwise a directory listing is generated using os.listdir. (In case the os.listdir call fails, a 404 error response is sent). Any IOError [...]

Later in do_GET: The file is always opened in binary mode.

should read:

If the file MIME type starts with 'text/' the file is opened in text mode; in any other case binary mode is used.

The docstrings inside the module are outdated too. Line 28 (class SimpleHTTPRequestHandler) says:

It assumes that all files are plain text files unless they have the extension ".html" in which case it assumes they are HTML files.

That's not true; that paragraph should be deleted, or make a reference to method guess_type() below.

Docstring for method guess_type() says:

[...] using text/plain as a default [...]

should read:

[...] using application/octet-stream as a default [...]