File: //usr/lib/python3/dist-packages/django/middleware/__pycache__/gzip.cpython-310.pyc
o
�a^ � @ sP d dl mZ d dlmZ d dlmZ d dlmZmZ ed�Z G dd� de�Z
dS ) � )�patch_vary_headers)�MiddlewareMixin)�_lazy_re_compile)�compress_sequence�compress_stringz\bgzip\bc @ s e Zd ZdZdd� ZdS )�GZipMiddlewarez�
Compress content if the browser allows gzip compression.
Set the Vary header accordingly, so that caches will base their storage
on the Accept-Encoding header.
c C s� |j st|j�dk r|S |�d�r|S t|d� |j�dd�}t�|�s&|S |j r4t |j
�|_
|jd= nt|j�}t|�t|j�krD|S ||_t
t|j��|jd<