Hacked By AnonymousFox
�
�܋f� � �J � d Z ddlmZ ddlmZmZ d� 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 # �N K � t | � � D ]�\ }}t |� � }|� d� � r9|dvr5|dd� � dd� � � � � |fV � �b|dv r,|� 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 # �4 K � dD ]}|| v r|| | fV � �dS )z8
Returns our whitelisted environment variables.
)�REMOTE_ADDR�SERVER_NAME�SERVER_PORTN� )r r s r �get_environr s@ � � � � =� $� $���'�>�>��w�s�|�#�#�#�#��$� $r c �X � | � d� � }d| v r | d }n<d| v r | d }n/| d }|t | d � � fdvr|d| d z z
}|� d� � r|d k r|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.
�wsgi.url_scheme�HTTP_X_FORWARDED_HOST� HTTP_HOSTr r ))�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��������Mr Fc �
� | d dt | � � g}|j }|rd� |� � dz S |t | � dd� � � d� � � � � � |r |d� � ni |t d| � dd� � � d� � z � � � � |s%| � d� � }|r |d|z � � 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.
r z://� �/�SCRIPT_NAME� PATH_INFO�QUERY_STRING�?)r. �append�joinr r* �rstrip�lstrip)r � root_only�strip_querystring� host_only�tmp�cat�qss r �get_current_urlr@ <