Commits

Ivan Vučica committed ac037d2

Support for base64 data. Launching with sudo.

  • Participants
  • Parent commits f13730b

Comments (0)

Files changed (2)

 # Obtain and install mod_pywebsocket from:
 #  https://code.google.com/p/pywebsocket/
 
-python -m mod_pywebsocket.standalone -d . --log-level=info -p 3000
+sudo python -m mod_pywebsocket.standalone -d . --log-level=info -p 3000
 import sys, os, struct, select
 
+import base64
+
+netBufferExpected = 0
+
 def web_socket_do_extra_handshake(request):
     """Received Sec-WebSocket-Extensions header value is parsed into
     request.ws_requested_extensions. pywebsocket creates extension
                 request.ws_stream.send_message(output, binary=True)
  
 def process_requestFD(request, netBuffer):
+    global netBufferExpected
     message = request.ws_stream.receive_message()
     if message is None:
         return netBuffer
 
     if isinstance(message, unicode):
         # text message - ignore it
+        incomingData = base64.decodestring(message)
         pass
     else:
         incomingData = message #base64.decodestring(aNode.getCDATA())
+    if 1: # temp
         netBuffer += incomingData
         while len(netBuffer) >= netBufferExpected:
             if len(netBuffer) > 0 and netBufferExpected > 0: