From b36b0a3765bcacb4dcdbf12060e9e99711855da8 Mon Sep 17 00:00:00 2001 From: ValeriyaSinevich Date: Mon, 18 Jun 2018 14:17:53 -0700 Subject: [PATCH] bpo-33663: Convert content length to string before putting to header (GH-7754) --- Lib/http/server.py | 2 +- .../next/Library/2018-06-17-10-48-03.bpo-33663.sUuGmq.rst | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Library/2018-06-17-10-48-03.bpo-33663.sUuGmq.rst diff --git a/Lib/http/server.py b/Lib/http/server.py index ea0e295d28..ca2dd50739 100644 --- a/Lib/http/server.py +++ b/Lib/http/server.py @@ -474,7 +474,7 @@ class BaseHTTPRequestHandler(socketserver.StreamRequestHandler): }) 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 0000000000..b2a8e3cc00 --- /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. -- 2.40.0