forked from orbit-oss/flask
Set the content-length header for sendfile. Fixes #447
This commit is contained in:
parent
de5038f2fb
commit
3bec75d230
2 changed files with 2 additions and 0 deletions
1
CHANGES
1
CHANGES
|
|
@ -13,6 +13,7 @@ Release date to be decided.
|
||||||
:ref:`upgrading-to-010` for more information.
|
:ref:`upgrading-to-010` for more information.
|
||||||
- Added ``template_test`` methods in addition to the already existing
|
- Added ``template_test`` methods in addition to the already existing
|
||||||
``template_filter`` method family.
|
``template_filter`` method family.
|
||||||
|
- Set the content-length header for x-sendfile.
|
||||||
|
|
||||||
Version 0.9
|
Version 0.9
|
||||||
-----------
|
-----------
|
||||||
|
|
|
||||||
|
|
@ -541,6 +541,7 @@ def send_file(filename_or_fp, mimetype=None, as_attachment=False,
|
||||||
if file is not None:
|
if file is not None:
|
||||||
file.close()
|
file.close()
|
||||||
headers['X-Sendfile'] = filename
|
headers['X-Sendfile'] = filename
|
||||||
|
headers['Content-Length'] = os.path.getsize(filename)
|
||||||
data = None
|
data = None
|
||||||
else:
|
else:
|
||||||
if file is None:
|
if file is None:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue