£Á°èZ¨Ä…–K§‚«“ô4“ÒÙ´dîfUÙÃÅ WKbyÊ¦•êŽ…È®FÒ¿ÊÎóCozá¬S@6{Í:›œêZÌ:Š•_%:¢¾¾~;‘Ã~èŠ©ÊÇí`ÔÑ©úë™µ'5I¿fš×WO%ø9¾«¾DK|€ùÍD”Ýs]nHÕ¶ê×Ó¼ãžªéUWŸÈË%DÒÕ¬ï‘]/Åcx  ‰ï2ß]ä6G[]S£ÔÏ¯rs{úëóµmÒï#UQxo·õÞCe]"±/aÙ&Eã4ú9Jé_ÞåëdãöKë)AÞ                  ¯¹ægƒÛowÐø^d™ý½ßB7áyMä9ÜÖUã
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
<html>
B
    Y                 @   sN   d Z ddlmZ ddlmZmZ dd Zdd Zdd	 ZdddZ	dd Z
dS )z
This module implements WSGI related helpers adapted from ``werkzeug.wsgi``

:copyright: (c) 2010 by the Werkzeug Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
    )absolute_import)	iteritemsurllib_quotec             c   sr   xlt | D ]`\}}t|}|drL|dkrL|dd dd |fV  q
|dkr
|dd |fV  q
W dS )z+
    Returns only proper HTTP headers.
    ZHTTP_)ZHTTP_CONTENT_TYPEZHTTP_CONTENT_LENGTH   N_-)ZCONTENT_TYPEZCONTENT_LENGTH)r   str
startswithreplacetitle)environkeyvalue r   A/opt/alt/python37/lib/python3.7/site-packages/raven/utils/wsgi.pyget_headers   s     r   c             c   s(   x"dD ]}|| kr|| | fV  qW dS )z8
    Returns our whitelisted environment variables.
    )REMOTE_ADDRSERVER_NAMESERVER_PORTNr   )r   r   r   r   r   get_environ   s    
r   c             C   s   |  d}d| kr| d }n>d| kr.| d }n,| d }|t| d fdkrZ|d| d  7 }|drz|d	krz|d
d }n|dr|dkr|d
d }|S )zReturn the real host for the given WSGI environment.  This takes care
    of the `X-Forwarded-Host` header.

    :param environ: the WSGI environment to get the host of.
    zwsgi.url_schemeZHTTP_X_FORWARDED_HOSTZ	HTTP_HOSTr   r   ))httpsZ443)httpZ80:z:80r   Nz:443r   )getr   endswith)r   schemeresultr   r   r   get_host$   s    


r   Fc             C   s   | d dt | g}|j}|r*d|d S |t| ddd |rR|d n<|td| ddd  |s| d}|r|d|  d|S )	a3  A handy helper function that recreates the full URL for the current
    request or parts of it.  Here an example:

    >>> from werkzeug import create_environ
    >>> env = create_environ("/?param=foo", "http://localhost/script")
    >>> get_current_url(env)
    'http://localhost/script/?param=foo'
    >>> get_current_url(env, root_only=True)
    'http://localhost/script/'
    >>> get_current_url(env, host_only=True)
    'http://localhost/'
    >>> get_current_url(env, strip_querystring=True)
    'http://localhost/script/'

    :param environ: the WSGI environment to get the current URL from.
    :param root_only: set `True` if you only want the root URL.
    :param strip_querystring: set to `True` if you don't want the querystring.
    :param host_only: set to `True` if the host URL should be returned.
    zwsgi.url_schemez:// /ZSCRIPT_NAMEZ	PATH_INFOZQUERY_STRING?)r   appendjoinr   r   rstriplstrip)r   Z	root_onlyZstrip_querystringZ	host_onlytmpcatqsr   r   r   get_current_url<   s    

r*   c          	   C   s:   y| d  dd  S  ttfk
r4   | dS X dS )z
    Naively yank the first IP address in an X-Forwarded-For header
    and assume this is correct.

    Note: Don't use this in security sensitive situations since this
    value may be forged from a client.
    ZHTTP_X_FORWARDED_FOR,r   r   N)splitstripKeyError
IndexErrorr   )r   r   r   r   get_client_ipa   s    r0   N)FFF)__doc__
__future__r   Zraven.utils.compatr   r   r   r   r   r*   r0   r   r   r   r   <module>   s   
 
$