mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Echo close reason and close code
Set code to None if it is STATUS_NO_STATUS_RECEIVED, which should not be sent across the wire.
This commit is contained in:
parent
175b3c2d27
commit
a640b9aaea
1 changed files with 11 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
|||
#!/usr/bin/python
|
||||
from mod_pywebsocket import msgutil
|
||||
from mod_pywebsocket import common
|
||||
|
||||
_GOODBYE_MESSAGE = u'Goodbye'
|
||||
|
||||
|
@ -23,3 +24,13 @@ def web_socket_transfer_data(request):
|
|||
else:
|
||||
request.ws_stream.send_message(line, binary=True)
|
||||
|
||||
def web_socket_passive_closing_handshake(request):
|
||||
# Echo close status code and reason
|
||||
code, reason = request.ws_close_code, request.ws_close_reason
|
||||
|
||||
# No status received is a reserved pseudo code representing an empty code,
|
||||
# so echo back an empty code in this case.
|
||||
if code == common.STATUS_NO_STATUS_RECEIVED:
|
||||
code = None
|
||||
|
||||
return code, reason
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue