Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #4549 -- WSGI server now sets mime type correctly for admin med…

…ia content. Thanks, Stefane Fermgier

git-svn-id: http://code.djangoproject.com/svn/django/trunk@5502 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 761c0a49e48fcf1ac6eb335693e0a2cea0a9e247 1 parent 903c561
Adrian Holovaty authored
1  AUTHORS
@@ -100,6 +100,7 @@ answer newbie questions, and generally made Django that much better:
100 100
     Marc Fargas <telenieko@telenieko.com>
101 101
     favo@exoweb.net
102 102
     Bill Fenner <fenner@gmail.com>
  103
+    Stefane Fermgier <sf@fermigier.com>
103 104
     Matthew Flanagan <http://wadofstuff.blogspot.com>
104 105
     Eric Floehr <eric@intellovations.com>
105 106
     Jorge Gajon <gajon@gajon.org>
5  django/core/servers/basehttp.py
@@ -9,7 +9,7 @@
9 9
 
10 10
 from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
11 11
 from types import ListType, StringType
12  
-import os, re, sys, time, urllib
  12
+import os, re, sys, time, urllib, mimetypes
13 13
 
14 14
 __version__ = "0.1"
15 15
 __all__ = ['WSGIServer','WSGIRequestHandler','demo_app']
@@ -629,6 +629,9 @@ def __call__(self, environ, start_response):
629 629
             else:
630 630
                 status = '200 OK'
631 631
                 headers = {}
  632
+                mime_type = mimetypes.guess_type(file_path)[0]
  633
+                if mime_type:
  634
+                    headers['Content-Type'] = mime_type
632 635
                 output = [fp.read()]
633 636
                 fp.close()
634 637
         start_response(status, headers.items())

0 notes on commit 761c0a4

Please sign in to comment.
Something went wrong with that request. Please try again.