]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
recognize a few more file types
authorGuido van Rossum <guido@python.org>
Mon, 18 Sep 1995 21:50:43 +0000 (21:50 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 18 Sep 1995 21:50:43 +0000 (21:50 +0000)
Lib/SimpleHTTPServer.py

index 67ec75afc86ef4a841b7bc74281f6f28e704dc61..dd3107abc6faf1bad7172896c0e17d00e84c9d7a 100644 (file)
@@ -6,7 +6,7 @@ and HEAD requests in a fairly straightforward manner.
 """
 
 
-__version__ = "0.2"
+__version__ = "0.3"
 
 
 import os
@@ -141,6 +141,9 @@ 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:
@@ -149,6 +152,10 @@ class SimpleHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
     extensions_map = {
            '': 'text/plain',   # Default, *must* be present
            '.html': 'text/html',
+           '.htm': 'text/html',
+           '.gif': 'image/gif',
+           '.jpg': 'image/jpeg',
+           '.jpeg': 'image/jpeg',
            }