recognize a few more file types
This commit is contained in:
parent
54c1510cb7
commit
3b7b8131a6
|
@ -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',
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue