← Back
Editing: http.cpython-311.pyc
� �|�eX � �N � d dl mZmZmZ d dlmZ d dlmZ G d� de� � ZdS )� )�cc_delim_re�get_conditional_response�set_response_etag)�MiddlewareMixin)�parse_http_date_safec � � e Zd ZdZd� Zd� 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 �6 � |j dk r|S | � |� � r$|� d� � st |� � |� d� � }|� d� � }|ot |� � }|s|rt ||||�� � S |S )N�GET�ETagz Last-Modified)�etag� last_modified�response)�method� needs_etag� has_headerr �getr r )�self�requestr r r s �8/usr/lib/python3/dist-packages/django/middleware/http.py�process_responsez)ConditionalGetMiddleware.process_response s� � � �>�U�"�"��O��?�?�8�$�$� (�X�-@�-@��-H�-H� (��h�'�'�'��|�|�F�#�#�� ���_�5�5� �%�M�*>�}�*M�*M� �� �=� �+���+�!� � � � � �� c � � t j |� dd� � � � }t d� |D � � � � S )z:Return True if an ETag header should be added to response.z Cache-Control� c 3 �F K � | ]}|� � � d k V � �dS )zno-storeN)�lower)�.0�headers r � <genexpr>z6ConditionalGetMiddleware.needs_etag.<locals>.<genexpr>) s/ � � � �T�T�F�6�<�<�>�>�Z�/�T�T�T�T�T�Tr )r �splitr �all)r r �cache_control_headerss r r z#ConditionalGetMiddleware.needs_etag&