<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css"
        integrity="sha512-SzlrxWUlpfuzQ+pcUCosxcglQRNAq/DZjVsC0lE40xsADsfeQoEypE+enwcOiGjk/bSuGGKHEyjSoQ1zVisanQ=="
        crossorigin="anonymous" referrerpolicy="no-referrer" />
</head>
</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 )z®Return 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   Néýÿÿÿz: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   
 
$