Ticket #4549: django-admin-mimetype.patch

File django-admin-mimetype.patch, 862 bytes (added by Stefane Fermgier <sf@…>, 17 years ago)

Patch fixing the issue

  • django/core/servers/basehttp.py

     
    99
    1010from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
    1111from types import ListType, StringType
    12 import os, re, sys, time, urllib
     12import os, re, sys, time, urllib, mimetypes
    1313
    1414__version__ = "0.1"
    1515__all__ = ['WSGIServer','WSGIRequestHandler','demo_app']
     
    630630            else:
    631631                status = '200 OK'
    632632                headers = {}
     633                mime_type = mimetypes.guess_type(file_path)[0]
     634                if mime_type:
     635                    headers['Content-Type'] = mime_type
    633636                output = [fp.read()]
    634637                fp.close()
    635638        start_response(status, headers.items())
Back to Top