Skip to content

Commit

Permalink
Merge pull request #2128 from csgactuarial/Fix-Headers-Regex
Browse files Browse the repository at this point in the history
Ensure header value is string before conducting regex search.
  • Loading branch information
tilgovi committed Oct 19, 2019
2 parents e147fea + ad6ed3f commit 235f06c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion gunicorn/http/wsgi.py
Expand Up @@ -253,10 +253,13 @@ def process_headers(self, headers):
if HEADER_RE.search(name):
raise InvalidHeaderName('%r' % name)

if not isinstance(value, str):
raise TypeError('%r is not a string' % value)

if HEADER_VALUE_RE.search(value):
raise InvalidHeader('%r' % value)

value = str(value).strip()
value = value.strip()
lname = name.lower().strip()
if lname == "content-length":
self.response_length = int(value)
Expand Down

0 comments on commit 235f06c

Please sign in to comment.