
    gC"                    r   U d dl mZ d dlZd dlZd dlmZ d dlmZ ddlmZ ddl	m
Z
mZmZ ddlmZ dd	lmZ dd
lmZ ddlmZmZ ddlmZ ddlmZmZmZmZ ddlmZ ddlmZm Z  ejB                  rddlm"Z"m#Z#  G d d      Z$ G d de$      Z%ejB                  r e$dd       Z&de'd<    e%dd       Z(de'd<   yy)    )annotationsN)HTTPException)ResponseNotReady   )
_TYPE_BODY)HTTPConnectionProxyConfigport_by_scheme)TimeoutError)BaseHTTPResponse)_TYPE_SOCKET_OPTIONS)_DEFAULT_TIMEOUT_TYPE_TIMEOUT)Url   )_RequestError_TimeoutErrorsend_requestsend_streaming_request)EmscriptenRequest)EmscriptenHttpResponseWrapperEmscriptenResponse)BaseHTTPConnectionBaseHTTPSConnectionc                     e Zd ZU ed   Zded<   ded<   ded<   ded	<   d
ed<   d
ed<   ded<   ded<   ded<   ded<   dZded<   dZded<   ded<   	 d*edddddd	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d+dZ		 	 	 d,	 	 	 	 	 	 	 	 	 d-d Z
d.d!Z	 	 d/dd"d"d"d#	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d0d$Zd1d%Zd.d&Zed2d'       Zed2d(       Zed2d)       Zy)3EmscriptenHTTPConnectionhttpztyping.ClassVar[int]default_portz%typing.ClassVar[_TYPE_SOCKET_OPTIONS]default_socket_optionszNone | floattimeoutstrhostintport	blocksizetuple[str, int] | Nonesource_address_TYPE_SOCKET_OPTIONS | Nonesocket_options
Url | NoneproxyProxyConfig | Noneproxy_configFboolis_verifiedNzbool | Noneproxy_is_verifiedzEmscriptenResponse | None	_responsei    )r    r'   r%   r)   r+   r-   c                   || _         || _        t        |t              r|nd| _        d| _        d| _        d | _        d | _        d | _	        || _
        d | _        d | _        d| _        y )Ng        r   TF)r"   r$   
isinstancefloatr    scheme_closedr1   r+   r-   r%   r'   r)   r/   )	selfr"   r$   r    r'   r%   r)   r+   r-   s	            /var/www/html/FastMealFinder_FlaskServer-InitialRelease/venv/lib/python3.12/site-packages/urllib3/contrib/emscripten/connection.py__init__z!EmscriptenHTTPConnection.__init__-   si     		",We"<w# 
 """     c                     y N )r7   r"   r$   headersr5   s        r8   
set_tunnelz#EmscriptenHTTPConnection.set_tunnelH   s     	r:   c                     y r<   r=   r7   s    r8   connectz EmscriptenHTTPConnection.connectQ   s    r:   T)chunkedpreload_contentdecode_contentenforce_content_lengthc               R   d| _         |j                  d      r+| j                   d| j                   d| j                   |z   }t        ||| j                  r| j                  nd|      }	|	j                  |       |r*|j                         D ]  \  }
}|	j                  |
|        d | _
        	 |st        |	      | _
        | j                  t        |	      | _
        y y # t        $ r}t        |j                        |d }~wt         $ r}t#        |j                        |d }~ww xY w)NF/z://:r   )urlmethodr    rE   )r6   
startswithr5   r"   r$   r   r    set_bodyitems
set_headerr1   r   r   r   r   messager   r   )r7   rK   rJ   bodyr>   rC   rD   rE   rF   requestkves                r8   rR   z EmscriptenHTTPConnection.requestT   s    >>#[[MTYYKq<sBC#$(LLDLLa)	
 	 )1""1a()	2"!7!@~~%!-g!6 & 	1qyy)q0 	2		*1	2s$   0.C   	D&)C??D&D!!D&c                    | j                   6t        | j                   | j                   j                  j                  |       S t	               )N)internal_responserJ   
connection)r1   r   rR   rJ   r   rA   s    r8   getresponsez$EmscriptenHTTPConnection.getresponse|   sA    >>%0"&..NN**..  #$$r:   c                     d| _         d | _        y )NT)r6   r1   rA   s    r8   closezEmscriptenHTTPConnection.close   s    r:   c                    | j                   S )zWhether the connection either is brand new or has been previously closed.
        If this property is True then both ``is_connected`` and ``has_connected_to_proxy``
        properties must be False.
        )r6   rA   s    r8   	is_closedz"EmscriptenHTTPConnection.is_closed   s     ||r:   c                     y)zLWhether the connection is actively connected to any origin (proxy or target)Tr=   rA   s    r8   is_connectedz%EmscriptenHTTPConnection.is_connected   s     r:   c                     y)zWhether the connection has successfully connected to its proxy.
        This returns False if no proxy is in use. Used to determine whether
        errors are coming from the proxy layer or from tunnelling to the target origin.
        Fr=   rA   s    r8   has_connected_to_proxyz/EmscriptenHTTPConnection.has_connected_to_proxy   s     r:   r   )r"   r!   r$   r#   r    r   r'   r&   r%   r#   r)   r(   r+   r*   r-   r,   returnNone)r   Nr   )
r"   r!   r$   
int | Noner>   typing.Mapping[str, str] | Noner5   r!   rc   rd   )rc   rd   )NN)rK   r!   rJ   r!   rQ   z_TYPE_BODY | Noner>   rf   rC   r.   rD   r.   rE   r.   rF   r.   rc   rd   )rc   r   )rc   r.   )__name__
__module____qualname__r
   r   __annotations__r/   r0   r   r9   r?   rB   rR   rY   r[   propertyr]   r_   ra   r=   r:   r8   r   r      s   )7)?L&?AA
I
IN**//$$K%){)((
 !
 "2156: +/!! !
 ! /! ! 4! ! )! 
!< 37  1	
  
 #'37&2  $#'+&2&2 &2  	&2
 1&2 &2 &2 &2 !%&2 
&2P%      r:   r   c                      e Zd ZU ed   ZdZded<   dZded<   dZded<   dZ	ded	<   ded
<   ded<   ded<   ded<   dZ
ded<   dZded<   dZded<   ded<   dZded<   	 deddej                   ddddddddddddddddd	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d fdZ	 	 	 	 	 	 	 	 	 d	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZ xZS )EmscriptenHTTPSConnectionhttpsNint | str | None	cert_reqs
str | Noneca_certsca_cert_dirNone | str | bytesca_cert_data	cert_filekey_filekey_passwordtyping.Any | Nonessl_contextssl_versionre   ssl_minimum_versionssl_maximum_version"None | str | typing.Literal[False]assert_hostnameassert_fingerprinti @  )r    r'   r%   r)   r+   r-   rp   r   r   server_hostnamerz   rr   rs   ru   r|   r}   r{   rv   rw   rx   c          
        t         |   ||||||||       d| _        || _        || _        || _        || _        || _        |
| _        || _	        || _
        || _        || _        |xr t        j                  j                  |      | _        |xr t        j                  j                  |      | _        || _        d | _        d| _        y )N)r$   r    r'   r%   r)   r+   r-   rn   T)superr9   r5   rw   rv   rx   rz   r   r   r   r{   r|   r}   ospath
expanduserrr   rs   ru   rp   r/   )r7   r"   r$   r    r'   r%   r)   r+   r-   rp   r   r   r   rz   rr   rs   ru   r|   r}   r{   rv   rw   rx   	__class__s                          r8   r9   z"EmscriptenHTTPSConnection.__init__   s    8 	))% 	 		
  "(&.."4&#6 #6  ARWW%7%7%A&J277+=+=k+J(  r:   c
                     y r<   r=   )
r7   rw   rv   rp   rx   rr   r   r   rs   ru   s
             r8   set_certz"EmscriptenHTTPSConnection.set_cert   s     	r:   rb   ).r"   r!   r$   r#   r    r   r'   r&   r%   r#   r)   zNone | _TYPE_SOCKET_OPTIONSr+   r*   r-   r,   rp   ro   r   r~   r   rq   r   rq   rz   ry   rr   rq   rs   rq   ru   rt   r|   re   r}   re   r{   ro   rv   rq   rw   rq   rx   rq   rc   rd   )	NNNNNNNNN)rw   rq   rv   rq   rp   ro   rx   rq   rr   rq   r   r~   r   rq   rs   rq   ru   rt   rc   rd   )rg   rh   ri   r
   r   rp   rj   rr   rs   ru   r{   r|   r}   r   r   r   r   r9   r   __classcell__)r   s   @r8   rm   rm      s?   !'*L"&I&Hj"K"'+L$+""$(K!(&**&**77%)
)
 : 
 "215 11 +/&*>B)-&*)-#"&+/*.*.(, $##'5: :  : 
 :  /:  :  (:  :  ):  $:  <:  ':   $!: " '#: $ %: &  ': ( )): * (+: , (-: . &/: 0 1: 2 3: 4 !5: 6 
7: |  $ $&*#'#>B)-"&+/  $	
 !  < '   ) 
r:   rm    r   _supports_http_protocolr   _supports_https_protocol))
__future__r   r   typinghttp.clientr   r   _base_connectionr   rX   r   r	   r
   
exceptionsr   responser   util.connectionr   util.timeoutr   r   util.urlr   fetchr   r   r   r   rR   r   r   r   TYPE_CHECKINGr   r   r   rm   r   rj   r   r=   r:   r8   <module>r      s    " 	  7 ( * E E & ( 3 ;  U U & G	KD DNY 8 Yz 
2J2q2Q/Q4MbRS4T1T r:   