mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Merge pull request #2128 from csgactuarial/Fix-Headers-Regex
Ensure header value is string before conducting regex search.
This commit is contained in:
commit
235f06c3af
@ -253,10 +253,13 @@ class Response(object):
|
||||
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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user