Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1796)

Unified Diff: Tools/Scripts/webkitpy/thirdparty/mod_pywebsocket/util.py

Issue 314043002: [WebSocket] Add tests for permessage deflate split frames. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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):

Powered by Google App Engine
This is Rietveld 408576698