summaryrefslogtreecommitdiffstats
path: root/Lib/wsgiref
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2011-01-06 17:18:32 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2011-01-06 17:18:32 (GMT)
commit59bf738874d2582ca37e49c162a18ef20442177e (patch)
treefbb41d7a287694932f1e16338399ed36178924ff /Lib/wsgiref
parent6e7d711d2a54087051e215f85115528a346c25d1 (diff)
downloadcpython-59bf738874d2582ca37e49c162a18ef20442177e.zip
cpython-59bf738874d2582ca37e49c162a18ef20442177e.tar.gz
cpython-59bf738874d2582ca37e49c162a18ef20442177e.tar.bz2
Merged revisions 87797 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r87797 | antoine.pitrou | 2011-01-06 18:17:04 +0100 (jeu., 06 janv. 2011) | 4 lines Issue #3839: wsgiref should not override a Content-Length header set by the application. Initial patch by Clovis Fabricio. ........
Diffstat (limited to 'Lib/wsgiref')
-rw-r--r--Lib/wsgiref/handlers.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/wsgiref/handlers.py b/Lib/wsgiref/handlers.py
index 8a78eec..4a77137 100644
--- a/Lib/wsgiref/handlers.py
+++ b/Lib/wsgiref/handlers.py
@@ -240,7 +240,9 @@ class BaseHandler:
def finish_content(self):
"""Ensure headers and content have both been sent"""
if not self.headers_sent:
- self.headers['Content-Length'] = "0"
+ # Only zero Content-Length if not set by the application (so
+ # that HEAD requests can be satisfied properly, see #3839)
+ self.headers.setdefault('Content-Length', "0")
self.send_headers()
else:
pass # XXX check if content-length was too short?