From e8626fcea2adb55762f3da0bddf8855137a6525c Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Wed, 23 Sep 2015 18:31:17 -0700 Subject: [PATCH] relay: deliver EventSource as utf-8 This allows the client (requests.py) to produce unicode fields and lines, instead of binary, which is necessary for py3 compatibility. --- src/wormhole/servers/relay.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wormhole/servers/relay.py b/src/wormhole/servers/relay.py index 1f4eb3c..766ab7f 100644 --- a/src/wormhole/servers/relay.py +++ b/src/wormhole/servers/relay.py @@ -80,7 +80,7 @@ class Channel(resource.Resource): if "text/event-stream" not in (request.getHeader("accept") or ""): request.setResponseCode(http.BAD_REQUEST, "Must use EventSource") return "Must use EventSource (Content-Type: text/event-stream)" - request.setHeader("content-type", "text/event-stream") + request.setHeader("content-type", "text/event-stream; charset=utf-8") ep = EventsProtocol(request) ep.sendEvent(json.dumps(self.welcome), name="welcome") handle = (their_side, their_msgnum, ep)