o
    j                     @   sF   d dl mZmZmZmZ d dlmZmZ d dlm	Z	 G dd dZ
dS )    )ListTupleAnyDict)MockHTTPRequestHTTPResponse)HTTPClientTransportc                   @   sZ   e Zd Zg dddfdededeeeef  dededefd	d
Z	de
fddZdd ZdS )RequestManagerNFurlreq_typeheadersdataneed_length	transportc           	      K   s4   || _ || _|| _|| _|| _|| _|| _d | _d S N)sessionr
   r   r   r   r   r   _RequestManager__response)	selfr   r
   r   r   r   r   r   kwargs r   /root/aizidognhua/tmp/workspace/projects/ec89d86c-575f-41c9-af57-ac45cbdbf775/venv/lib/python3.10/site-packages/asysocks/unicomm/protocol/client/http/requestmgr.py__init__   s   
zRequestManager.__init__returnc              
      s   zY| j | j\}}| jd u r| j  I d H | _| j jd ur1| j jjdkr1| j j| I d H W S | j || j	}| jj
|| j||| j| jdI d H | _| j j| jt| | jW S  tyh } z|d }~ww )Nstart)r   r   r   )r   process_urlr
   r   get_transportauthmanagerstatusauthenticateapply_headersr   requestr   r   r   r   	cookiejarextract_cookiesr   	Exception)r   targetfullurlr   er   r   r   
__aenter__   s   
&zRequestManager.__aenter__c                    s$   | j d ur| j  I d H  d S d S r   )r   cleanup)r   exc_typeexctbr   r   r   	__aexit__#   s   
zRequestManager.__aexit__)__name__
__module____qualname__strr   r   bytesboolr   r   r   r'   r,   r   r   r   r   r	      s    8
r	   N)typingr   r   r   r   6asysocks.unicomm.protocol.client.http.commons.messagesr   r   /asysocks.unicomm.protocol.client.http.transportr   r	   r   r   r   r   <module>   s   