Add binary support in WebSocket test server's echo handler.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 5 Dec 2011 07:42:19 +0000 (07:42 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 5 Dec 2011 07:42:19 +0000 (07:42 +0000)
https://bugs.webkit.org/show_bug.cgi?id=73649

Patch by Takashi Toyoshima <toyoshim@chromium.org> on 2011-12-04
Reviewed by Eric Seidel.

* http/tests/websocket/tests/hybi/echo_wsh.py: Support binary frames.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@101974 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/http/tests/websocket/tests/hybi/echo_wsh.py

index ca28253..1be0a32 100644 (file)
@@ -1,3 +1,12 @@
+2011-12-04  Takashi Toyoshima  <toyoshim@chromium.org>
+
+        Add binary support in WebSocket test server's echo handler.
+        https://bugs.webkit.org/show_bug.cgi?id=73649
+
+        Reviewed by Eric Seidel.
+
+        * http/tests/websocket/tests/hybi/echo_wsh.py: Support binary frames.
+
 2011-12-04  Kent Tamura  <tkent@chromium.org>
 
         [Chromium] Rebaseline of placeholder tests for r101742 and r101848.
index 79c3f10..9851d26 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2009, Google Inc.
+# Copyright 2009, 2011, Google Inc.
 # All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 
-from mod_pywebsocket import msgutil
-
-
-_GOODBYE_MESSAGE = 'Goodbye'
+_GOODBYE_MESSAGE = u'Goodbye'
 
 
 def web_socket_do_extra_handshake(request):
@@ -40,7 +37,12 @@ def web_socket_do_extra_handshake(request):
 
 def web_socket_transfer_data(request):
     while True:
-        line = msgutil.receive_message(request)
-        msgutil.send_message(request, line)
-        if line == _GOODBYE_MESSAGE:
+        line = request.ws_stream.receive_message()
+        if line is None:
             return
+        if isinstance(line, unicode):
+            request.ws_stream.send_message(line, binary=False)
+            if line == _GOODBYE_MESSAGE:
+                return
+        else:
+            request.ws_stream.send_message(line, binary=True)