Index: net/data/websocket/echo_wsh.py |
diff --git a/third_party/python_gflags/setup.py b/net/data/websocket/echo_wsh.py |
old mode 100755 |
new mode 100644 |
similarity index 68% |
copy from third_party/python_gflags/setup.py |
copy to net/data/websocket/echo_wsh.py |
index 573db2d410c8dc94bcc990e6f79685753b08f277..38646c32ceb515f15dd572622689c79ee61e543f |
--- a/third_party/python_gflags/setup.py |
+++ b/net/data/websocket/echo_wsh.py |
@@ -1,6 +1,4 @@ |
-#!/usr/bin/env python |
- |
-# Copyright (c) 2007, Google Inc. |
+# Copyright 2011, Google Inc. |
# All rights reserved. |
# |
# Redistribution and use in source and binary forms, with or without |
@@ -29,16 +27,28 @@ |
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
-from setuptools import setup |
- |
-setup(name='python-gflags', |
- version='2.0', |
- description='Google Commandline Flags Module', |
- license='BSD', |
- author='Google Inc. and others', |
- author_email='google-gflags@googlegroups.com', |
- url='http://code.google.com/p/python-gflags', |
- py_modules=["gflags", "gflags_validators"], |
- data_files=[("bin", ["gflags2man.py"])], |
- include_package_data=True, |
- ) |
+ |
+_GOODBYE_MESSAGE = u'Goodbye' |
+ |
+ |
+def web_socket_do_extra_handshake(request): |
+ # This example handler accepts any request. See origin_check_wsh.py for how |
+ # to reject access from untrusted scripts based on origin value. |
+ |
+ pass # Always accept. |
+ |
+ |
+def web_socket_transfer_data(request): |
+ while True: |
+ 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) |
+ |
+ |
+# vi:sts=4 sw=4 et |