]> granicus.if.org Git - python/commitdiff
Bug #1117556: SimpleHTTPServer now tries to find and use the system's
authorGeorg Brandl <georg@python.org>
Wed, 14 Jun 2006 08:50:03 +0000 (08:50 +0000)
committerGeorg Brandl <georg@python.org>
Wed, 14 Jun 2006 08:50:03 +0000 (08:50 +0000)
mime.types file for determining MIME types.

Lib/SimpleHTTPServer.py
Misc/NEWS

index 089936f7405c722b3e0a9a34da883ce736aee43d..6f348a1097f3e901c141cdf5765de2797bff1152 100644 (file)
@@ -191,7 +191,9 @@ class SimpleHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
             return self.extensions_map[ext]
         else:
             return self.extensions_map['']
-
+    
+    if not mimetypes.inited:
+        mimetypes.init() # try to read system mime.types
     extensions_map = mimetypes.types_map.copy()
     extensions_map.update({
         '': 'application/octet-stream', # Default
index 630d36b8457d6a18bc28085db8e5fd25da4a49a3..a8099f74823cdce443a853788656c5c9fcf9e6d9 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -156,6 +156,9 @@ Extension Modules
 Library
 -------
 
+- Bug #1117556: SimpleHTTPServer now tries to find and use the system's
+  mime.types file for determining MIME types.
+
 - Bug #1339007: Shelf objects now don't raise an exception in their
   __del__ method when initialization failed.