mirror of
https://github.com/django/daphne.git
synced 2025-07-30 00:49:44 +03:00
Fix: Always call Request.write()
The spec says 'content' is an optional key, defaulting to b''. But before this commit, if 'content' wasn't specified, Request.write() was not called. In conjunction with setting 'more_content' to True, this would result in nothing being written on the transport. If 'content' was set to b'' instead, the HTTP preamble and any headers were written as expected. That smells like a bug, so I'm making sure we're always calling Request.write().
This commit is contained in:
parent
04118cab7e
commit
129fe71f83
|
@ -240,9 +240,10 @@ class WebRequest(http.Request):
|
|||
header = header.encode("latin1")
|
||||
self.responseHeaders.addRawHeader(header, value)
|
||||
logger.debug("HTTP %s response started for %s", message['status'], self.reply_channel)
|
||||
|
||||
# Write out body
|
||||
if "content" in message:
|
||||
http.Request.write(self, message['content'])
|
||||
http.Request.write(self, message.get('content', b''))
|
||||
|
||||
# End if there's no more content
|
||||
if not message.get("more_content", False):
|
||||
self.finish()
|
||||
|
|
Loading…
Reference in New Issue
Block a user