
    fis                         d dl Z d dlmZ d dlmZ d dlmZ er$d dlmZ d dlmZ d dlm	Z	 d dlm
Z
 d d	lmZ d d
lmZ d Zd Zd Zd Zd ZdS )    N)should_send_default_pii)_filter_headers)TYPE_CHECKING)Any)Dict)Optional)Union)Literal)AnnotatedValuec                     i }| d         D ]J\  }}|                     d          }|                     d          }||v r||         dz   |z   ||<   E|||<   K|S )z^
    Extract headers from the ASGI scope, in the format that the Sentry protocol expects.
    headerslatin-1z, )decode)
asgi_scoper   raw_key	raw_valuekeyvalues         t/var/www/html/Pagina-Ingenieria-Requisitos/venv/lib/python3.11/site-packages/sentry_sdk/integrations/_asgi_common.py_get_headersr      sx    
 G(3 ! !nnY''  ++'>>"3<$.6GCLL GCLLN    c                 F   |                      d|          }|                      dd          }|                      dd          |                      dd          z   }|r	|d||S |:|\  }}dd	dd	d
                     |          }||k    r|d|d||S |d||S |S )zR
    Extract URL from the ASGI scope, without also including the querystring.
    schemeserverN	root_path pathz://P   i  )httphttpswswss:)get)r   default_schemehostr   r   r   portdefault_ports           r   _get_urlr)   #   s    
 ^^Hn55F^^Hd++F>>+r**Z^^FB-G-GGD 2$ffddDD11
d "S3GGKKFSS<%+VVTTT44>>$ffddDD11Kr   c                     |                      d          }|sdS t          j                            |                    d                    S )zb
    Extract querystring from the ASGI scope, in the format that the Sentry protocol expects.
    query_stringNr   )r$   urllibparseunquoter   )r   qss     r   
_get_queryr0   9   sD    
 
	'	'B t<		) 4 4555r   c                    t          |           }	 |d                             d          d                                         S # t          t          f$ r Y nw xY w	 |d         S # t          $ r Y nw xY w|                     d          d         S )zh
    Extract IP Address from the ASGI scope based on request headers with fallback to scope client.
    zx-forwarded-for,r   z	x-real-ipclient)r   splitstripKeyError
IndexErrorr$   )r   r   s     r   _get_ipr8   D   s    
 :&&G()//44Q7==???j!   {##    >>(##A&&s#   2A AAA$ $
A10A1c                    i }| d         }|dv rz|                      d          |d<   t          t          |                     x|d<   }t          |           |d<   t	          | |dk    rdnd|                     d                    |d	<   |                      d
          }|r"t                      rdt          |           i|d<   |S )zG
    Returns data related to the HTTP request from the ASGI scope.
    type)r   	websocketmethodr   r+   r   r!   r&   urlr3   REMOTE_ADDRenv)r$   r   r   r0   r)   r   r8   )r   request_datatyr   r3   s        r   _get_request_datarB   W   s    
 L	F	B	"""!+!9!9X,;L<T<T,U,UUY''1*'='=^$&",,D'++f:M:M
 
U ^^H%%F C)++ C,gj.A.ABUr   )r,   sentry_sdk.scoper   $sentry_sdk.integrations._wsgi_commonr   typingr   r   r   r   r	   typing_extensionsr
   sentry_sdk.utilsr   r   r)   r0   r8   rB    r   r   <module>rI      s    4 4 4 4 4 4 @ @ @ @ @ @             0))))))//////  "  ,6 6 6' ' '&    r   