summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2013-12-19 14:52:48 -0300
committerTomás Touceda <chiiph@leap.se>2013-12-19 14:52:48 -0300
commitcb616b80c47a5c251f4c66808396d0ac1352a390 (patch)
treec7dd3f4014a8e4833177c12cbe14dd3005e3da1a /server
parentbf0cdbd1db302867bacf2646090db4673f922957 (diff)
parentecc05503b393844ee8b864db9d32db288b875d11 (diff)
Merge remote-tracking branch 'refs/remotes/kali/fix/really_enable_gzip' into develop
Diffstat (limited to 'server')
-rw-r--r--server/src/leap/soledad/server/__init__.py2
-rw-r--r--server/src/leap/soledad/server/gzip_middleware.py (renamed from server/src/leap/soledad/server/gzip.py)10
2 files changed, 5 insertions, 7 deletions
diff --git a/server/src/leap/soledad/server/__init__.py b/server/src/leap/soledad/server/__init__.py
index de5daf62..a4b25fe2 100644
--- a/server/src/leap/soledad/server/__init__.py
+++ b/server/src/leap/soledad/server/__init__.py
@@ -110,7 +110,7 @@ if version.base() == "12.0.0":
sys.modules['OpenSSL.tsafe'] = old_tsafe
from leap.soledad.server.auth import SoledadTokenAuthMiddleware
-from leap.soledad.server.gzip import GzipMiddleware
+from leap.soledad.server.gzip_middleware import GzipMiddleware
from leap.soledad.common import (
SHARED_DB_NAME,
diff --git a/server/src/leap/soledad/server/gzip.py b/server/src/leap/soledad/server/gzip_middleware.py
index 92906513..986c5738 100644
--- a/server/src/leap/soledad/server/gzip.py
+++ b/server/src/leap/soledad/server/gzip_middleware.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# gzip.py
+# gzip_middleware.py
# Copyright (C) 2013 LEAP
#
# This program is free software: you can redistribute it and/or modify
@@ -17,8 +17,8 @@
"""
Gzip middleware for WSGI apps.
"""
-import gzip
import StringIO
+from gzip import GzipFile
class GzipMiddleware(object):
@@ -32,11 +32,9 @@ class GzipMiddleware(object):
def __call__(self, environ, start_response):
if 'gzip' not in environ.get('HTTP_ACCEPT_ENCODING', ''):
return self.app(environ, start_response)
- if (environ['PATH_INFO'][-3:] != '.js' and environ[
- 'PATH_INFO'][-4:] != '.css'):
- return self.app(environ, start_response)
+
buffer = StringIO.StringIO()
- output = gzip.GzipFile(
+ output = GzipFile(
mode='wb',
compresslevel=self.compresslevel,
fileobj=buffer