summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
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