recognize a few more file types

This commit is contained in:
Guido van Rossum 1995-09-18 21:50:43 +00:00
parent 54c1510cb7
commit 3b7b8131a6
1 changed files with 8 additions and 1 deletions

View 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',
}