Skip to content
Permalink
Browse files

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.
  • Loading branch information...
jsanders committed Jan 12, 2016
1 parent 175b3c2 commit a640b9aaeaeb054276ca6bdb6982c5346f9548d3
Showing with 11 additions and 0 deletions.
  1. +11 −0 tests/wpt/web-platform-tests/websockets/handlers/echo_wsh.py
@@ -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

0 comments on commit a640b9a

Please sign in to comment.
You can’t perform that action at this time.