Kaydet (Commit) 3b7b8131 authored tarafından Guido van Rossum's avatar Guido van Rossum

recognize a few more file types

üst 54c1510c
...@@ -6,7 +6,7 @@ and HEAD requests in a fairly straightforward manner. ...@@ -6,7 +6,7 @@ and HEAD requests in a fairly straightforward manner.
""" """
__version__ = "0.2" __version__ = "0.3"
import os import os
...@@ -141,6 +141,9 @@ class SimpleHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): ...@@ -141,6 +141,9 @@ class SimpleHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
""" """
base, ext = posixpath.splitext(path) 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): if self.extensions_map.has_key(ext):
return self.extensions_map[ext] return self.extensions_map[ext]
else: else:
...@@ -149,6 +152,10 @@ class SimpleHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): ...@@ -149,6 +152,10 @@ class SimpleHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
extensions_map = { extensions_map = {
'': 'text/plain', # Default, *must* be present '': 'text/plain', # Default, *must* be present
'.html': 'text/html', '.html': 'text/html',
'.htm': 'text/html',
'.gif': 'image/gif',
'.jpg': 'image/jpeg',
'.jpeg': 'image/jpeg',
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment