diff options
author | Guido van Rossum <guido@python.org> | 1995-09-18 21:50:43 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1995-09-18 21:50:43 (GMT) |
commit | 3b7b8131a618bf7ad4aa8c5608a9853ae9539d3a (patch) | |
tree | 4256b87a9acd957f7422a51526c0122e12cbf6ef | |
parent | 54c1510cb7eeda3135cd4ad23aebef8d13db7bc1 (diff) | |
download | cpython-3b7b8131a618bf7ad4aa8c5608a9853ae9539d3a.zip cpython-3b7b8131a618bf7ad4aa8c5608a9853ae9539d3a.tar.gz cpython-3b7b8131a618bf7ad4aa8c5608a9853ae9539d3a.tar.bz2 |
recognize a few more file types
-rw-r--r-- | Lib/SimpleHTTPServer.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Lib/SimpleHTTPServer.py b/Lib/SimpleHTTPServer.py index 67ec75a..dd3107a 100644 --- a/Lib/SimpleHTTPServer.py +++ b/Lib/SimpleHTTPServer.py @@ -6,7 +6,7 @@ and HEAD requests in a fairly straightforward manner. """ -__version__ = "0.2" +__version__ = "0.3" import os @@ -143,12 +143,19 @@ class SimpleHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): base, ext = posixpath.splitext(path) if self.extensions_map.has_key(ext): return self.extensions_map[ext] + ext = string.lower(ext) + if self.extensions_map.has_key(ext): + return self.extensions_map[ext] else: return self.extensions_map[''] extensions_map = { '': 'text/plain', # Default, *must* be present '.html': 'text/html', + '.htm': 'text/html', + '.gif': 'image/gif', + '.jpg': 'image/jpeg', + '.jpeg': 'image/jpeg', } |