OwlCyberSecurity - MANAGER
Edit File: http.cpython-39.pyc
a ���eP � @ s@ d dl mZmZmZ d dlmZ d dlmZ G dd� de�ZdS )� )�cc_delim_re�get_conditional_response�set_response_etag)�MiddlewareMixin)�parse_http_date_safec @ s e Zd ZdZdd� Zdd� ZdS )�ConditionalGetMiddlewarez� Handle conditional GET operations. If the response has an ETag or Last-Modified header and the request has If-None-Match or If-Modified-Since, replace the response with HttpNotModified. Add an ETag header if needed. c C sf |j dkr|S | �|�r*|�d�s*t|� |�d�}|�d�}|oHt|�}|sR|rbt||||d�S |S )N�GET�ETagz Last-Modified)�etag� last_modified�response)�method� needs_etag� has_headerr �getr r )�self�requestr r r � r �W/home/gouroczh/virtualenv/pat/3.9/lib/python3.9/site-packages/django/middleware/http.py�process_response s �z)ConditionalGetMiddleware.process_responsec C s$ t �|�dd��}tdd� |D ��S )z:Return True if an ETag header should be added to response.z Cache-Control� c s s | ]}|� � d kV qdS )zno-storeN)�lower)�.0�headerr r r � <genexpr>( � z6ConditionalGetMiddleware.needs_etag.<locals>.<genexpr>)r �splitr �all)r r Zcache_control_headersr r r r % s z#ConditionalGetMiddleware.needs_etagN)�__name__� __module__�__qualname__�__doc__r r r r r r r s r N) Zdjango.utils.cacher r r Zdjango.utils.deprecationr Zdjango.utils.httpr r r r r r �<module> s