Skip to content

Commit

Permalink
Merge pull request #1676 from aenglander/bugfix/1659-ssl-eof-error-py…
Browse files Browse the repository at this point in the history
…thon-3.5

Only write body when there is a body to write.
  • Loading branch information
davidism committed Jan 4, 2020
2 parents 95d0e01 + 1d8cd3c commit 6d39f04
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGES.rst
Expand Up @@ -3,8 +3,12 @@
Version 0.16.1
--------------

Unreleased

- Fix import location in deprecation messages for subpackages.
:issue:`1663`
- Fix an SSL error on Python 3.5 when the dev server responds with no
content. :issue:`1659`


Version 0.16.0
Expand Down
4 changes: 3 additions & 1 deletion src/werkzeug/serving.py
Expand Up @@ -273,7 +273,9 @@ def write(data):
self.end_headers()

assert isinstance(data, bytes), "applications must write bytes"
self.wfile.write(data)
if data:
# Only write data if there is any to avoid Python 3.5 SSL bug
self.wfile.write(data)
self.wfile.flush()

def start_response(status, response_headers, exc_info=None):
Expand Down

0 comments on commit 6d39f04

Please sign in to comment.