
    h                     ^    S SK Jr  S SKJr  S SKJr  S SKJrJr  \" S5      r	 " S S\5      r
g)	    )patch_vary_headers)MiddlewareMixin)_lazy_re_compile)compress_sequencecompress_stringz\bgzip\bc                   "    \ rS rSrSrSrS rSrg)GZipMiddleware	   z
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                   ^ ^ UR                   (       d  [        UR                  5      S:  a  U$ UR                  S5      (       a  U$ [	        US5        UR
                  R                  SS5      n[        R                  U5      (       d  U$ UR                   (       ab  UR                  (       a   UR                  mUU 4S jnU" 5       Ul
        O#[        UR                  T R                  S9Ul
        UR                  S	 Os[        UR                  T R                  S9n[        U5      [        UR                  5      :  a  U$ XRl        [        [        UR                  5      5      UR                  S'   UR                  S	5      nU(       a(  UR!                  S
5      (       a  SU-   UR                  S	'   SUR                  S'   U$ )N   zContent-Encoding)zAccept-EncodingHTTP_ACCEPT_ENCODING c                 \   >#    T  S h  vN n [        U TR                  S97v   M"   N
 g 7f)Nmax_random_bytes)r   r   )chunkorignal_iteratorselfs    H/var/www/html/env/lib/python3.13/site-packages/django/middleware/gzip.pygzip_wrapper5GZipMiddleware.process_response.<locals>.gzip_wrapper'   s1     '7 e-!-1-B-B '7s   ,*(*,*,r   zContent-LengthETag"zW/gzip)	streaminglencontent
has_headerr   METAgetre_accepts_gzipsearchis_asyncstreaming_contentr   r   headersr   str
startswith)r   requestresponseaer   compressed_contentetagr   s   `      @r   process_responseGZipMiddleware.process_response   s   !!c(*:*:&;c&AO 122O8%9:\\4b9%%b))O   $,#=#=  .:^*->..%)%:%:.*   !12 "1  !%!6!6" %&#h.>.>*??114S9I9I5J1KH-.
 ||F#DOOC(('+d{HV$/5+,     N)__name__
__module____qualname____firstlineno____doc__r   r.   __static_attributes__r1   r0   r   r	   r	   	   s     8r0   r	   N)django.utils.cacher   django.utils.deprecationr   django.utils.regex_helperr   django.utils.textr   r   r"   r	   r1   r0   r   <module>r<      s)    1 4 6 @";/A_ Ar0   