Skip to content

Commit

Permalink
Echo close reason and close code
Browse files Browse the repository at this point in the history
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 19, 2016
1 parent 175b3c2 commit a640b9a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions 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'

Expand All @@ -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.