gecko/testing/mochitest/pywebsocket
Patrick McManus 0823794e32 bug 663096 update mochitest/pywebsocket to drain input to avoid RST r=biesi
--HG--
extra : transplant_source : %27%05%5C%B1%E8j2%22q%BE%BBY%D7%8B9%81%18%18I%03
2011-06-10 16:52:30 -04:00
..
mod_pywebsocket bug 663096 update mochitest/pywebsocket to drain input to avoid RST r=biesi 2011-06-10 16:52:30 -04:00
COPYING Bug 570789. Add WebSocket support to mochitest. r=ted 2010-06-16 22:38:55 -07:00
README bug 663096 update mochitest/pywebsocket to drain input to avoid RST r=biesi 2011-06-10 16:52:30 -04:00
standalone.py bug 663096 update mochitest/pywebsocket to drain input to avoid RST r=biesi 2011-06-10 16:52:30 -04:00

mod_pywebsocket http://pywebsocket.googlecode.com/svn
version 489
supporting ietf-07

includes the following minor patch:: (first bit supports symlinked wsh
files, the second allows python 2.5 to work)

also includes patch for 663096 to drain input buffers before closing
in order to avoid RST

diff --git a/testing/mochitest/pywebsocket/mod_pywebsocket/dispatch.py b/testing/mochitest/pywebsocket/mod_pywebsocket/dispatch.py
--- a/testing/mochitest/pywebsocket/mod_pywebsocket/dispatch.py
+++ b/testing/mochitest/pywebsocket/mod_pywebsocket/dispatch.py
@@ -60,17 +60,18 @@ def _normalize_path(path):
         path: the path to normalize.
 
     Path is converted to the absolute path.
     The input path can use either '\\' or '/' as the separator.
     The normalized path always uses '/' regardless of the platform.
     """
 
     path = path.replace('\\', os.path.sep)
-    path = os.path.realpath(path)
+    # do not normalize away symlinks in mochitest
+    # path = os.path.realpath(path)
     path = path.replace('\\', '/')
     return path
 
 
 def _create_path_to_resource_converter(base_dir):
     base_dir = _normalize_path(base_dir)
 
     base_len = len(base_dir)

diff --git a/testing/mochitest/pywebsocket/mod_pywebsocket/_stream_base.py b/testing/mochitest/pywebsocket/mod_pywebsocket/_stream_base.py
--- a/testing/mochitest/pywebsocket/mod_pywebsocket/_stream_base.py
+++ b/testing/mochitest/pywebsocket/mod_pywebsocket/_stream_base.py
@@ -92,19 +92,17 @@ class StreamBase(object):
         prepends remote address to the exception message and raise again.
 
         Raises:
             ConnectionTerminatedException: when read returns empty string.
         """
 
         bytes = self._request.connection.read(length)
         if not bytes:
-            raise ConnectionTerminatedException(
-                'Receiving %d byte failed. Peer (%r) closed connection' %
-                (length, (self._request.connection.remote_addr,)))
+            raise ConnectionTerminatedException('connection terminated: read failed')
         return bytes
 
     def _write(self, bytes):
         """Writes given bytes to connection. In case we catch any exception,
         prepends remote address to the exception message and raise again.
         """
 
         try: