|
|
@ -538,6 +538,7 @@ def send_file(filename_or_fp, mimetype=None, as_attachment=False, |
|
|
|
rv.expires = int(time() + cache_timeout) |
|
|
|
rv.expires = int(time() + cache_timeout) |
|
|
|
|
|
|
|
|
|
|
|
if add_etags and filename is not None: |
|
|
|
if add_etags and filename is not None: |
|
|
|
|
|
|
|
try: |
|
|
|
rv.set_etag('flask-%s-%s-%s' % ( |
|
|
|
rv.set_etag('flask-%s-%s-%s' % ( |
|
|
|
os.path.getmtime(filename), |
|
|
|
os.path.getmtime(filename), |
|
|
|
os.path.getsize(filename), |
|
|
|
os.path.getsize(filename), |
|
|
@ -546,6 +547,10 @@ def send_file(filename_or_fp, mimetype=None, as_attachment=False, |
|
|
|
else filename |
|
|
|
else filename |
|
|
|
) & 0xffffffff |
|
|
|
) & 0xffffffff |
|
|
|
)) |
|
|
|
)) |
|
|
|
|
|
|
|
except OSError: |
|
|
|
|
|
|
|
warn('Access %s failed, maybe it does not exist, so ignore etags in ' |
|
|
|
|
|
|
|
'headers' % filename, stacklevel=2) |
|
|
|
|
|
|
|
|
|
|
|
if conditional: |
|
|
|
if conditional: |
|
|
|
rv = rv.make_conditional(request) |
|
|
|
rv = rv.make_conditional(request) |
|
|
|
# make sure we don't send x-sendfile for servers that |
|
|
|
# make sure we don't send x-sendfile for servers that |
|
|
|