ok

Mini Shell

Direktori : /opt/cloudlinux/venv/lib/python3.11/site-packages/raven/utils/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/raven/utils/__pycache__/wsgi.cpython-311.pyc

�

�܋f���J�dZddlmZddlmZmZd�Zd�Zd�Z		dd�Z	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#�NK�t|��D]�\}}t|��}|�d��r9|dvr5|dd��dd�����|fV��b|dvr,|�dd�����|fV���dS)z+
    Returns only proper HTTP headers.
    �HTTP_)�HTTP_CONTENT_TYPE�HTTP_CONTENT_LENGTH�N�_�-)�CONTENT_TYPE�CONTENT_LENGTH)r�str�
startswith�replace�title)�environ�key�values   �a/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/raven/utils/wsgi.py�get_headersr
s����� ��(�(�7�7�
��U��#�h�h���>�>�'�"�"�	7�s�7�(8�(8��a�b�b�'�/�/�#�s�+�+�1�1�3�3�U�:�:�:�:�:�
�6�
6�
6��+�+�c�3�'�'�-�-�/�/��6�6�6�6��
7�7�c#�4K�dD]}||vr|||fV��dS)z8
    Returns our whitelisted environment variables.
    )�REMOTE_ADDR�SERVER_NAME�SERVER_PORTN�)rrs  r�get_environrs@����=�$�$���'�>�>��w�s�|�#�#�#�#��$�$rc�X�|�d��}d|vr	|d}n<d|vr	|d}n/|d}|t|d��fdvr|d|dzz
}|�d��r|d	kr|d
d�}n%|�d��r|d
kr
|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.
    �wsgi.url_scheme�HTTP_X_FORWARDED_HOST�	HTTP_HOSTrr))�https�443)�http�80�:z:80r%N���z:443r#���)�getr�endswith)r�scheme�results   r�get_hostr.$s����[�[�*�
+�
+�F��'�)�)��0�1���	��	�	���%�����'���C��
�.�/�/�0�0�1�1��c�G�M�2�2�2�F�
���u����&�F�"2�"2��������	����	 �	 ��V�w�%6�%6��������MrFc	�
�|ddt|��g}|j}|rd�|��dzS|t|�dd���d������|r|d��ni|td|�dd���d��z����|s%|�d��}|r|d|z��d�|��S)	a3A 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.
    r z://��/�SCRIPT_NAME�	PATH_INFO�QUERY_STRING�?)r.�append�joinrr*�rstrip�lstrip)r�	root_only�strip_querystring�	host_only�tmp�cat�qss       r�get_current_urlr@<s��*�$�%�u�h�w�.?�.?�
@�C�

�*�C��"��w�w�s�|�|�c�!�!��C��W�[�[���3�3�:�:�3�?�?�@�@�A�A�A�����C�������L��w�{�{�;��;�;�B�B�3�G�G�G�H�H�I�I�I� �	����^�,�,�B��
���C�"�H�
�
�
�
�7�7�3�<�<�rc���	|d�d��d���S#ttf$r|�d��cYSwxYw)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.
    �HTTP_X_FORWARDED_FOR�,rr)�split�strip�KeyError�
IndexErrorr*)rs r�
get_client_iprHasj��*��-�.�4�4�S�9�9�!�<�B�B�D�D�D���j�!�*�*�*��{�{�=�)�)�)�)�)�*���s�25�&A�AN)FFF)�__doc__�
__future__r�raven.utils.compatrrrrr.r@rHrrr�<module>rLs�����'�&�&�&�&�&�6�6�6�6�6�6�6�6�
7�
7�
7�$�$�$����0AF�#�"�"�"�"�J*�*�*�*�*r

Zerion Mini Shell 1.0