
Á«‘_Š  ã               @   sp   d  d l  m Z d  d l  m Z d  d l m Z d  d l m Z Gd d „  d e ƒ Z Gd d „  d e ƒ Z d	 S)
é   )Údump_header)Úparse_set_header)Úenviron_property)Úheader_propertyc               @   sR   e  Z d  Z d Z e d d d ƒZ e d d e d d ƒZ e d d d	 ƒZ d
 S)ÚCORSRequestMixinz®A mixin for :class:`~werkzeug.wrappers.BaseRequest` subclasses
    that adds descriptors for Cross Origin Resource Sharing (CORS)
    headers.

    .. versionadded:: 1.0
    ZHTTP_ORIGINÚdoczœThe host that the request originated from. Set :attr:`~CORSResponseMixin.access_control_allow_origin` on the response to indicate which origins are allowed.Z#HTTP_ACCESS_CONTROL_REQUEST_HEADERSÚ	load_funczÖSent with a preflight request to indicate which headers will be sent with the cross origin request. Set :attr:`~CORSResponseMixin.access_control_allow_headers` on the response to indicate which headers are allowed.Z"HTTP_ACCESS_CONTROL_REQUEST_METHODzÔSent with a preflight request to indicate which method will be used for the cross origin request. Set :attr:`~CORSResponseMixin.access_control_allow_methods` on the response to indicate which methods are allowed.N)	Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Úoriginr   Zaccess_control_request_headersZaccess_control_request_method© r   r   ú:/tmp/pip-build-5gj8f0j9/Werkzeug/werkzeug/wrappers/cors.pyr      s   		r   c               @   sÇ   e  Z d  Z d Z e d d „  ƒ Z e j d d „  ƒ Z e d d e d e	 d d	 ƒZ
 e d
 d e d e	 d d ƒZ e d d d ƒZ e d d e d e	 d d ƒZ e d d e d e d d ƒZ d S)ÚCORSResponseMixinz¯A mixin for :class:`~werkzeug.wrappers.BaseResponse` subclasses
    that adds descriptors for Cross Origin Resource Sharing (CORS)
    headers.

    .. versionadded:: 1.0
    c             C   s   d |  j  k S)zÈWhether credentials can be shared by the browser to
        JavaScript code. As part of the preflight request it indicates
        whether credentials can be used on the cross origin request.
        z Access-Control-Allow-Credentials)Úheaders)Úselfr   r   r   Ú access_control_allow_credentials6   s    z2CORSResponseMixin.access_control_allow_credentialsc             C   s3   | d k r d |  j  d <n |  j  j d d  ƒ d  S)NTÚtruez Access-Control-Allow-Credentials)r   Úpop)r   Úvaluer   r   r   r   >   s    zAccess-Control-Allow-Headersr   Z	dump_funcr   z8Which headers can be sent with the cross origin request.zAccess-Control-Allow-Methodsz7Which methods can be used for the cross origin request.zAccess-Control-Allow-OriginzEThe origin or '*' for any origin that may make cross origin requests.zAccess-Control-Expose-Headersz>Which headers can be shared by the browser to JavaScript code.zAccess-Control-Max-AgezIThe maximum age in seconds the access control settings can be cached for.N)r	   r
   r   r   Úpropertyr   Úsetterr   r   r   Zaccess_control_allow_headersZaccess_control_allow_methodsZaccess_control_allow_originZaccess_control_expose_headersÚintÚstrZaccess_control_max_ager   r   r   r   r   .   s4   				r   N)	Úhttpr   r   Úutilsr   r   Úobjectr   r   r   r   r   r   Ú<module>   s
   '