î
ªÍ X³  ã               @   sV   d  d l  m Z d  d l m Z d  d l m Z m Z m Z Gd d „  d e ƒ Z d S)é    )Úget_conditional_response)ÚMiddlewareMixin)Ú	http_dateÚparse_http_date_safeÚunquote_etagc               @   s"   e  Z d  Z d Z d d „  Z d S)ÚConditionalGetMiddlewarea  
    Handles conditional GET operations. If the response has an ETag or
    Last-Modified header, and the request has If-None-Match or
    If-Modified-Since, the response is replaced by an HttpNotModified.

    Also sets the Date and Content-Length response-headers.
    c             C   s¨   t  ƒ  | d <| j rC | j d ƒ rC t t | j ƒ ƒ | d <n  | j d ƒ } | j d ƒ } | rv t | ƒ } n  | s‚ | r¤ t | d t	 | ƒ d | d | ƒS| S)NZDatezContent-LengthZETagzLast-ModifiedÚetagÚlast_modifiedÚresponse)
r   Z	streamingÚ
has_headerÚstrÚlenÚcontentÚgetr   r   r   )ÚselfÚrequestr
   r   r	   © r   úD/home/ubuntu/projects/ifolica/build/django/django/middleware/http.pyÚprocess_response   s    z)ConditionalGetMiddleware.process_responseN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r      s   r   N)	Zdjango.utils.cacher   Zdjango.utils.deprecationr   Zdjango.utils.httpr   r   r   r   r   r   r   r   Ú<module>   s   