Commit 920c7ac7 authored by Peter V. Saveliev's avatar Peter V. Saveliev

cli.server: fix encoding for the http request handler

parent 5a9af1cd
......@@ -10,6 +10,18 @@ except ImportError:
from http.server import BaseHTTPRequestHandler
class ProxyEncoder(object):
def __init__(self, wfile):
self.wfile = wfile
def write(self, data):
self.wfile.write(data.encode('utf-8'))
def flush(self):
self.wfile.flush()
class Handler(BaseHTTPRequestHandler):
def do_error(self, code, reason):
......@@ -42,7 +54,7 @@ class Handler(BaseHTTPRequestHandler):
else:
request = {'commands': [data]}
session = Session(ndb=self.server.ndb, stdout=self.wfile)
session = Session(ndb=self.server.ndb, stdout=ProxyEncoder(self.wfile))
self.send_response(200)
self.end_headers()
for cmd in request['commands']:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment