Convert str to bytes on wsproxy

In python3, concatenating string to bytes is not supported so
zun-wsproxy broke. This commit convert string to bytes before
sending the buffer.

Change-Id: I236d5c39b0415cc345a11ab5e79d7e7082f367c9
Closes-Bug: #1854090
This commit is contained in:
Hongbin Lu 2019-11-26 18:36:51 +00:00
parent fa4dc78c7e
commit 8fbd944cd5
1 changed files with 3 additions and 0 deletions

View File

@ -26,6 +26,7 @@ import time
import docker
from oslo_log import log as logging
from oslo_utils import uuidutils
import six
import six.moves.urllib.parse as urlparse
import websockify
@ -120,6 +121,8 @@ class ZunProxyRequestHandlerBase(object):
'host': self.server.target_host,
'port': self.server.target_port})
raise self.CClose(1000, "Target closed")
if isinstance(buf, six.string_types):
buf = buf.encode()
self.cqueue.append(buf)
def do_websocket_proxy(self, target):