Index: Tools/Scripts/webkitpy/thirdparty/mod_pywebsocket/util.py |
diff --git a/Tools/Scripts/webkitpy/thirdparty/mod_pywebsocket/util.py b/Tools/Scripts/webkitpy/thirdparty/mod_pywebsocket/util.py |
index 109d04923656fa694d672cd21e4914c0eff70443..d224ae3942d7fe2cf77b988495ef6e28a1bf48dc 100644 |
--- a/Tools/Scripts/webkitpy/thirdparty/mod_pywebsocket/util.py |
+++ b/Tools/Scripts/webkitpy/thirdparty/mod_pywebsocket/util.py |
@@ -331,8 +331,8 @@ class _RFC1979Deflater(object): |
self._window_bits = window_bits |
self._no_context_takeover = no_context_takeover |
- def filter(self, bytes, flush=True, bfinal=False): |
- if self._deflater is None or (self._no_context_takeover and flush): |
+ def filter(self, bytes, end=True, bfinal=False): |
+ if self._deflater is None: |
self._deflater = _Deflater(self._window_bits) |
if bfinal: |
@@ -341,11 +341,17 @@ class _RFC1979Deflater(object): |
result = result + chr(0) |
self._deflater = None |
return result |
- if flush: |
+ |
+ result = self._deflater.compress_and_flush(bytes) |
+ if end: |
# Strip last 4 octets which is LEN and NLEN field of a |
# non-compressed block added for Z_SYNC_FLUSH. |
- return self._deflater.compress_and_flush(bytes)[:-4] |
- return self._deflater.compress(bytes) |
+ result = result[:-4] |
+ |
+ if self._no_context_takeover and end: |
+ self._deflater = None |
+ |
+ return result |
class _RFC1979Inflater(object): |