Skip to content

Commit

Permalink
#1836 delay zlib import until needed
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@19273 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed May 11, 2018
1 parent 76a85b9 commit e51457d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/xpra/net/websocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
# later version. See the file COPYING for details.

import os
import zlib
import posixpath
try:
from urllib import unquote #python2 @UnusedImport
Expand Down Expand Up @@ -231,6 +230,7 @@ def send_head(self):
assert len(content)==content_length, "expected %s to contain %i bytes but read %i bytes" % (path, content_length, len(content))
if content_length>128 and ("gzip" in accept) and (ext not in (".png", )):
#gzip it on the fly:
import zlib
assert len(content)==content_length, "expected %s to contain %i bytes but read %i bytes" % (path, content_length, len(content))
gzip_compress = zlib.compressobj(9, zlib.DEFLATED, zlib.MAX_WBITS | 16)
compressed_content = gzip_compress.compress(content) + gzip_compress.flush()
Expand Down

0 comments on commit e51457d

Please sign in to comment.