]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Bug #1117556: SimpleHTTPServer now tries to find and use the system's
authorGeorg Brandl <georg@python.org>
Wed, 14 Jun 2006 08:50:05 +0000 (08:50 +0000)
committerGeorg Brandl <georg@python.org>
Wed, 14 Jun 2006 08:50:05 +0000 (08:50 +0000)
mime.types file for determining MIME types.
 (backport from rev. 46955)

Lib/SimpleHTTPServer.py
Misc/NEWS

index fe0c46653f4a81bf7d389f3ad353d9d9739f7df1..482d189317d0221ff7b01d64f18f9dd2ab056e5b 100644 (file)
@@ -185,7 +185,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 691d20981f87f59f530b98fbc9d019bec9565425..a4c1864c2b3589c7a964ba340a61a016dd89282a 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -53,6 +53,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.