File: //usr/local/CyberCP/lib/python3.10/site-packages/django/middleware/__pycache__/gzip.cpython-310.pyc
o
�h� � @ 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 ZdZdZdd� 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.
�d c s |j st|j�dk r|S |�d�r|S t|d� |j�dd�}t�|�s&|S |j rI|j r;|j
� � �fdd�}|� |_
n t|j
�jd�|_
|j
d = n t|j�jd�}t|�t|j�kr\|S ||_tt|j��|j
d <