Make sure ping/pong data is in the correct type

For Python 3 we need to make sure the data payload is bytes, not str.
This commit is contained in:
Pierre Ossman 2018-02-28 10:58:25 +01:00
parent 3a03e3c59d
commit 3b2a0a5884
1 changed files with 2 additions and 2 deletions

View File

@ -202,11 +202,11 @@ class WebSockifyRequestHandler(WebSocketRequestHandler, SimpleHTTPRequestHandler
""" Send a WebSocket orderly close frame. """
self.request.shutdown(socket.SHUT_RDWR, code, reason)
def send_pong(self, data=''):
def send_pong(self, data=''.encode('ascii')):
""" Send a WebSocket pong frame. """
self.request.pong(data)
def send_ping(self, data=''):
def send_ping(self, data=''.encode('ascii')):
""" Send a WebSocket ping frame. """
self.request.ping(data)