mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-24 06:59:52 +01:00
static handler: if 'wsgi.file_wrapper' throws exception, default to streaming directly
This commit is contained in:
parent
e61078ab96
commit
bdf4f9bc71
@ -207,9 +207,15 @@ class StaticHandler(BaseHandler):
|
|||||||
data.seek(0)
|
data.seek(0)
|
||||||
headers = [('Content-Length', str(size))]
|
headers = [('Content-Length', str(size))]
|
||||||
|
|
||||||
|
reader = None
|
||||||
|
|
||||||
if 'wsgi.file_wrapper' in wbrequest.env:
|
if 'wsgi.file_wrapper' in wbrequest.env:
|
||||||
reader = wbrequest.env['wsgi.file_wrapper'](data)
|
try:
|
||||||
else:
|
reader = wbrequest.env['wsgi.file_wrapper'](data)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
if not reader:
|
||||||
reader = iter(lambda: data.read(), b'')
|
reader = iter(lambda: data.read(), b'')
|
||||||
|
|
||||||
content_type = 'application/octet-stream'
|
content_type = 'application/octet-stream'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user