Compare commits
2 Commits
f6d641eeef
...
56e0c2391d
Author | SHA1 | Date |
---|---|---|
pictuga | 56e0c2391d | |
pictuga | 679f406a12 |
|
@ -21,6 +21,8 @@ import re
|
||||||
import lxml.etree
|
import lxml.etree
|
||||||
|
|
||||||
import cgitb
|
import cgitb
|
||||||
|
import wsgiref.util
|
||||||
|
import mimetypes
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# python 2
|
# python 2
|
||||||
|
@ -180,7 +182,7 @@ def cgi_file_handler(environ, start_response, app):
|
||||||
# file successfully open
|
# file successfully open
|
||||||
headers = {}
|
headers = {}
|
||||||
headers['status'] = '200 OK'
|
headers['status'] = '200 OK'
|
||||||
headers['content-type'] = mimetypes.guess_type(path)[0]
|
headers['content-type'] = mimetypes.guess_type(path)[0] or 'application/octet-stream'
|
||||||
start_response(headers['status'], list(headers.items()))
|
start_response(headers['status'], list(headers.items()))
|
||||||
return wsgiref.util.FileWrapper(f)
|
return wsgiref.util.FileWrapper(f)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue