mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
make specific case for websockets
This commit is contained in:
parent
8c6266866e
commit
4f54c06121
@ -17,12 +17,19 @@ class Response(object):
|
|||||||
|
|
||||||
for name, value in headers:
|
for name, value in headers:
|
||||||
assert isinstance(name, basestring), "%r is not a string" % name
|
assert isinstance(name, basestring), "%r is not a string" % name
|
||||||
assert isinstance(value, basestring), "%r is not a string" % value
|
if is_hoppish(name):
|
||||||
assert not is_hoppish(name), "%s is a hop-by-hop header." % name
|
lname = name.lower().strip()
|
||||||
if name.lower().strip() == "transfer-encoding":
|
if lname == "transfer-encoding":
|
||||||
if value.lower().strip() == "chunked":
|
if value.lower().strip() == "chunked":
|
||||||
self.chunked = True
|
self.chunked = True
|
||||||
self.headers.append((name.strip(), value.strip()))
|
elif lname == "connection":
|
||||||
|
# handle websocket
|
||||||
|
if value.lower().strip() != "upgrade":
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
# ignore hopbyhop headers
|
||||||
|
continue
|
||||||
|
self.headers.append((name.strip(), str(value).strip()))
|
||||||
|
|
||||||
def default_headers(self):
|
def default_headers(self):
|
||||||
return [
|
return [
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user