Don't fake a close code in close response

If the peer doesn't send us a close code, then don't send any code back
in the response. Sending 1005 is explicitly wrong as the specification
states that code should only be used locally and never be sent over the
network.
This commit is contained in:
Pierre Ossman
2023-09-06 12:25:19 +02:00
parent 354668143f
commit 43c371fc7a
+1 -1
View File
@@ -666,7 +666,7 @@ class WebSocket(object):
continue
if code is None:
self.close_code = code = 1005
self.close_code = 1005
self.close_reason = "No close status code specified by peer"
else:
self.close_code = code