- Change the default file type to application/octet-stream.
- Add support to recognize .py, .c, .h files as text/plain (this is
what I use most :-).
"""
-__version__ = "0.5"
+__version__ = "0.6"
import os
import urllib
import cgi
import shutil
+import mimetypes
from StringIO import StringIO
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',
- }
+ extensions_map = mimetypes.types_map.copy()
+ extensions_map.update({
+ '': 'application/octet-stream', # Default
+ '.py': 'text/plain',
+ '.c': 'text/plain',
+ '.h': 'text/plain',
+ })
def test(HandlerClass = SimpleHTTPRequestHandler,