From ad6ed3f4c835eb6a86ba61dadfd3896ddcbb48e3 Mon Sep 17 00:00:00 2001 From: Jeff Brooks Date: Tue, 15 Oct 2019 09:03:44 -0500 Subject: [PATCH] Implement check and exception for str type on value in Response process_headers method. --- gunicorn/http/wsgi.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gunicorn/http/wsgi.py b/gunicorn/http/wsgi.py index b786bc09..3524471f 100644 --- a/gunicorn/http/wsgi.py +++ b/gunicorn/http/wsgi.py @@ -253,7 +253,8 @@ class Response(object): if HEADER_RE.search(name): raise InvalidHeaderName('%r' % name) - value = str(value) + if not isinstance(value, str): + raise TypeError('%r is not a string' % value) if HEADER_VALUE_RE.search(value): raise InvalidHeader('%r' % value)