[New-bugs-announce] [issue32628] Add configurable DirectoryIndex to http.server

Erik Paulson report at bugs.python.org
Mon Jan 22 23:16:45 EST 2018

New submission from Erik Paulson <epaulson at unit1127.com>:

In http.server and SimpleHTTPRequestHandler - the send_head function is hard-coded to treat index.html and index.htm as files to return in a directory - if neither of those files are present, it lists the directory. 

It would be very nice to be able to specify other files to use as a directory index, similar to the DirectoryIndex directive from Apache.

I think it'd be straight forward to add some kind of list you could set, just like you can modify extensions_map to include other types of MIME types. 

Would it be OK to just add a directory_index list with index.html and index.htm on by default that people could do like
Handler.directory_index.append("index.htmlx") in their setup? Or would such an API be better with some kind of helper?

components: Library (Lib)
messages: 310468
nosy: epaulson
priority: normal
severity: normal
status: open
title: Add configurable DirectoryIndex to http.server
versions: Python 3.7

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list