Commit graph

198 commits

Author SHA1 Message Date
David Lord
b51ab3ff2c
encode filenames as ascii instead of latin-1
latin-1 is allowed by pep3333, but that breaks gunicorn
2018-05-28 06:36:47 -07:00
David Lord
5965cb7e1c
rename to FLASK_SKIP_DOTENV, add docs, test 2018-04-29 14:20:17 -07:00
David Lord
49a38ed999
use theme provided by pallets-sphinx-themes 2018-04-18 12:05:31 -07:00
David Lord
310fbfcf64
revert copyright year to project start
add copyright header to files
2018-02-08 12:43:30 -08:00
David Lord
af32ea0b94
bump dependency versions 2018-02-06 08:03:09 -08:00
David Lord
87c2e121e0
clean up FLASK_ENV docs [ci skip] 2018-01-10 15:46:11 -08:00
Armin Ronacher
2433522d29
Add Support for FLASK_ENV (#2570)
This introduces environments to Flask
2018-01-06 17:07:56 +01:00
Hsiaoming Yang
22e072379b cleanup werkzeug import (#2582) 2018-01-06 10:49:01 +01:00
David Lord
333865ea34
windows python 2 doesn't provide inet_pton 2018-01-05 13:27:31 -08:00
Adrian Moennich
eb1c2faf9f Merge remote-tracking branch 'upstream/0.12-maintenance' 2017-11-25 00:44:07 +01:00
ThiefMaster
c52e1b7388 Fix ValueError for some invalid Range requests
fixes #2526
2017-11-25 00:37:49 +01:00
Grey Li
851ca95778 Fix typo in comment 2017-09-23 22:26:48 +08:00
David Lord
723e665004
remove deprecated Request.module 2017-06-26 07:46:33 -07:00
David Lord
235c830759
document inherited attributes for Flask and Blueprint
closes #480
[ci skip]
2017-06-06 07:51:52 -07:00
David Lord
b8eba0a3fa
use existing response.vary property to set vary header
closes #2345
2017-05-29 10:09:24 -07:00
David Lord
bdf31cd423
extract patch_vary_header to helpers 2017-05-25 10:26:02 -07:00
David Lord
f7c35bf0d5 safe_join on Windows uses posixpath
fixes #2033
closes #2059
2017-05-16 08:34:37 +02:00
David Lord
2a65794306
safe_join on Windows uses posixpath
fixes #2033
closes #2059
2017-05-15 16:58:01 -07:00
David Lord
f75ad9fca2
refactor session cookie domain logic
cache result of session cookie domain
add warnings for session cookie domain issues
add changelog
2017-05-13 21:59:00 -07:00
José Oliveira
c3d49e29ea
show warning if session cookie domain is ip
closes #2007
2017-05-13 21:47:43 -07:00
rocambolesque
19fbe3a18f
Add scheme to url_build error handler parameters 2017-04-20 08:30:07 -07:00
David Lord
09b49104f3
filename can be latin-1, not just ascii
only normalize basic name when utf-8 header is needed
ref #2223
2017-04-12 09:59:25 -07:00
David Lord
c1973016ea
style cleanup
break out header parts in test
test for no filename* parameter for ascii header
2017-04-07 18:02:31 -07:00
Antonio Larrosa
d50a5db5ed Keep using only filename if it's valid ascii 2017-04-07 20:34:52 +02:00
Antonio Larrosa
bf023e7dc0 Remove unidecode dependency and use unicodedata instead
I found a way to remove the unidecode dependency without sacrificing
much by using unicodedata.normalize .
2017-03-30 17:32:21 +02:00
Antonio Larrosa
6ef45f30ab Fix previous commits to work with python 2 and python 3
Also, parse_options_header seems to interpret filename* so we better
test the actual value used in the headers (and since it's valid
in any order, use a set to compare)
2017-03-24 20:05:01 +01:00
Antonio Larrosa
0049922f2e Fix send_file to work with non-ascii filenames
This commit implements https://tools.ietf.org/html/rfc2231#section-4 in
order to support sending unicode characters. Tested on both Firefox and
Chromium under Linux.

This adds unidecode as a dependency, which might be relaxed by using
.encode('latin-1', 'ignore') but wouldn't be as useful.

Also, added a test for the correct headers to be added.

Previously, using a filename parameter to send_file with unicode characters, it
failed with the next error since HTTP headers don't allow non latin-1 characters.
Error on request:
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/werkzeug/serving.py", line 193, in run_wsgi
    execute(self.server.app)
  File "/usr/lib/python3.6/site-packages/werkzeug/serving.py", line 186, in execute
    write(b'')
  File "/usr/lib/python3.6/site-packages/werkzeug/serving.py", line 152, in write
    self.send_header(key, value)
  File "/usr/lib64/python3.6/http/server.py", line 509, in send_header
    ("%s: %s\r\n" % (keyword, value)).encode('latin-1', 'strict'))
UnicodeEncodeError: 'latin-1' codec can't encode character '\uff0f' in position 58: ordinal not in range(256)

Fixes #1286
2017-03-23 17:30:48 +01:00
Kim Blomqvist
3fc8be5a4e Disable debug when FLASK_DEBUG=False (#2155)
Convert FLASK_DEBUG envvar to lower before test if in tuple
2017-01-17 07:15:51 -08:00
Joël Charles
7186a5aaf5 make use of range requests if available in werkzeug (#2031)
* make use of range requests if available in werkzeug

* different logic for testing werkzeug functionality
2016-09-26 12:43:46 +02:00
Markus Unterwaditzer
01081dbe6c Avoid always-false statement
See https://github.com/pallets/flask/pull/1849/files#r79371299
2016-09-19 23:30:24 +02:00
Bruno Thalmann
09fec941f4 Removed unused import. (#2026) 2016-09-18 14:10:00 +02:00
Armin Ronacher
1f0ca894a2 Killed now dead code 2016-09-11 16:57:43 +03:00
Armin Ronacher
a30951ec28 Do not error for unknown files if send_file sends an actual file 2016-09-10 03:33:53 +03:00
Roman
92ce20eeac Fix error in send_file helper (#2003)
* Fix error in send_file (mimetype_filename is not defined)

* fix formatting error message in send_file
2016-09-04 16:28:05 -07:00
Markus Unterwaditzer
71e10be286 Properly remove f.name usage in send_file (#1988)
* Properly remove f.name usage in send_file

* Update changelogs

* Fix tests
2016-08-26 03:08:03 +02:00
David Lord
7c271401b2 pass value directly to last_modified 2016-06-05 12:42:34 -07:00
Prachi Shirish Khadke
af515cc7ea Add last_modified arg for send_file
Enhancement: Add last_modified arg of type DateTime to send_file.

Fixes pallets/flask#1321
2016-06-05 10:59:17 -07:00
Giampaolo Eusebi
03ea11fe76 Make safe_join able to safely join multiple paths 2016-06-04 11:26:16 +02:00
Dan Sully
8458cc5cd1 Remove deprecation warnings for add_etags & mimetype guessing for send_file()
Fix #1849
2016-06-03 14:52:33 +02:00
Armin Ronacher
b13e83a2f2 Merge pull request #1813 from pallets/bugfix/scheme
Resolve state issue for url_for with forced scheme
2016-05-26 21:48:20 +02:00
Armin Ronacher
523e271183 Implemented simplified CLI interface 2016-05-26 20:07:52 +02:00
Armin Ronacher
6aee9f6d77 Resolve state issue for url_for with forced scheme
This fixes #1596
2016-05-22 10:45:29 +02:00
David Hou
9f1be8e795 Raise BadRequest if static file name is invalid
* Raise BadRequest if static file name is invalid

* Clean up syntax a bit

* Remove unnecessary close()
2016-04-02 21:07:27 +02:00
Shipeng Feng
cc536c8a7b Fixed stream_with_context if decorated function has parameters 2016-04-01 16:17:45 -07:00
nivm
edb65cc0f0 remove 'flask' from etags to obscure server technologies 2016-01-10 12:33:35 +02:00
Timo Furrer
d526932a09 support timedelta for SEND_FILE_MAX_AGE_DEFAULT config variable 2015-10-24 07:04:23 +02:00
lobeck
128bc76af0 Revert "make external_url_handler example py3 compliant" 2015-07-16 13:53:59 +02:00
Christian Becker
93fe1d54bd make external_url_handler example py3 compliant
- a raises statement with multiple values is no longer allowed in python 3
2015-07-16 02:45:56 +02:00
Markus Unterwaditzer
bc4c1777e9 Document static_folder 2015-06-11 19:55:51 +02:00
Keyan Pishdadian
805692108a Update send_file() docs to clarify encoding requirement #1286 2015-06-06 07:38:09 +02:00