[Python-checkins] bpo-33663: Convert content length to string before putting to header (GH-7754)

Miss Islington (bot) webhook-mailer at python.org
Mon Jun 18 17:38:01 EDT 2018


https://github.com/python/cpython/commit/53d1e9fad316e1404535157fe21cab8919f707c9
commit: 53d1e9fad316e1404535157fe21cab8919f707c9
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2018-06-18T14:37:56-07:00
summary:

bpo-33663: Convert content length to string before putting to header (GH-7754)

(cherry picked from commit b36b0a3765bcacb4dcdbf12060e9e99711855da8)

Co-authored-by: ValeriyaSinevich <valeriya.sinevich at phystech.edu>

files:
A Misc/NEWS.d/next/Library/2018-06-17-10-48-03.bpo-33663.sUuGmq.rst
M Lib/http/server.py

diff --git a/Lib/http/server.py b/Lib/http/server.py
index ea0e295d2834..ca2dd507392c 100644
--- a/Lib/http/server.py
+++ b/Lib/http/server.py
@@ -474,7 +474,7 @@ def send_error(self, code, message=None, explain=None):
             })
             body = content.encode('UTF-8', 'replace')
             self.send_header("Content-Type", self.error_content_type)
-            self.send_header('Content-Length', int(len(body)))
+            self.send_header('Content-Length', str(len(body)))
         self.end_headers()
 
         if self.command != 'HEAD' and body:
diff --git a/Misc/NEWS.d/next/Library/2018-06-17-10-48-03.bpo-33663.sUuGmq.rst b/Misc/NEWS.d/next/Library/2018-06-17-10-48-03.bpo-33663.sUuGmq.rst
new file mode 100644
index 000000000000..b2a8e3cc00c6
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2018-06-17-10-48-03.bpo-33663.sUuGmq.rst
@@ -0,0 +1 @@
+Convert content length to string before putting to header.



More information about the Python-checkins mailing list