a XC?h���@sNdZddlZddlZddlZddlZddlZddlZddlZddl Z ddl m Z gd�Z dZdZdZdZd Zd Ze��ejj�d d �ejj��D�Zd ZdZdZe�d�jZe�d�j Z!e�d�Z"e�d�Z#hd�Z$d@dd�Z%Gdd�dej&j'�Z(dd�Z)e(fdd�Z*Gdd�dej+�Z,Gd d!�d!�Z-z ddl.Z.Wne/�yHYn0Gd"d#�d#e-�Z0e �1d#�Gd$d%�d%e2�Z3Gd&d'�d'e3�Z4Gd(d)�d)e3�Z5Gd*d+�d+e3�Z6Gd,d-�d-e3�Z7Gd.d/�d/e3�Z8Gd0d1�d1e3�Z9Gd2d3�d3e3�Z:Gd4d5�d5e:�Z;Gd6d7�d7e:�ZGdd?�d?e@e>�ZAe3ZBdS)Aa� HTTP/1.1 client library HTTPConnection goes through a number of "states", which define when a client may legally make another request or fetch the response for a particular request. This diagram details these state transitions: (null) | | HTTPConnection() v Idle | | putrequest() v Request-started | | ( putheader() )* endheaders() v Request-sent |\_____________________________ | | getresponse() raises | response = getresponse() | ConnectionError v v Unread-response Idle [Response-headers-read] |\____________________ | | | response.read() | putrequest() v v Idle Req-started-unread-response ______/| / | response.read() | | ( putheader() )* endheaders() v v Request-started Req-sent-unread-response | | response.read() v Request-sent This diagram presents the following rules: -- a second request may not be started until {response-headers-read} -- a response [object] cannot be retrieved until {request-sent} -- there is no differentiation between an unread response body and a partially read response body Note: this enforcement is applied by the HTTPConnection class. The HTTPResponse class does not enforce this state machine, which implies sophisticated clients may accelerate the request/response pipeline. Caution should be taken, though: accelerating the states beyond the above pattern may imply knowledge of the server's connection-close behavior for certain requests. For example, it is impossible to tell whether the server will close the connection UNTIL the response headers have been read; this means that further requests cannot be placed into the pipeline until it is known that the server will NOT be closing the connection. Logical State __state __response ------------- ------- ---------- Idle _CS_IDLE None Request-started _CS_REQ_STARTED None Request-sent _CS_REQ_SENT None Unread-response _CS_IDLE Req-started-unread-response _CS_REQ_STARTED Req-sent-unread-response _CS_REQ_SENT �N)�urlsplit)� HTTPResponse�HTTPConnection� HTTPException� NotConnected�UnknownProtocol�UnknownTransferEncoding�UnimplementedFileMode�IncompleteRead� InvalidURL�ImproperConnectionState�CannotSendRequest�CannotSendHeader�ResponseNotReady� BadStatusLine� LineTooLong�RemoteDisconnected�error� responses�Pi�ZUNKNOWNZIdlezRequest-startedz Request-sentcCsi|] }||j�qS�)�phrase)�.0�vrr�0/opt/alt/python39/lib64/python3.9/http/client.py� k�rii�ds[^:\s][^:\r\n]*s\n(?![ \t])|\r(?![ \t\n])z[- ]z[-]>ZPATCHZPUTZPOST�datac Csjz |�d�WStyd}z@t|j|j|j|jd|��||j|j�|f�d�WYd}~n d}~00dS)zd?�Z �Z!S)FrrNcCsR|�d�|_||_||_d|_|_t|_t|_t|_ t|_ t|_ t|_ t|_ dS)N�rb)Zmakefiler@� debuglevel�_methodrA�msg�_UNKNOWN�version�status�reason�chunked� chunk_left�length� will_close)r2�sockrK�method�urlrrr�__init__�s  zHTTPResponse.__init__c Cst|j�td�d�}t|�tkr*td��|jdkrBtdt|��|sNt d��z|� dd�\}}}WnBt y�z|� dd�\}}d}Wnt y�d}Yn0Yn0|� d �s�|� �t|��z$t|�}|d ks�|d kr�t|��Wnt �yt|��Yn0|||fS) Nr,rCz status linerzreply:z-Remote end closed connection without response��zHTTP/ri�)�strr@r=r>r.rrK�print�reprr�split� ValueError� startswith� _close_connr�int)r2r4rOrPrQrrr� _read_statuss2      zHTTPResponse._read_statusc Cs�|jdurdS|��\}}}|tkr&qHt|j�}|jdkrDtd|�~q||_|_|� �|_ |dvrnd|_ n|� d�r�d|_ nt |��t|j�|_|_|jdkr�|j��D]\}}td|d|�q�|j�d �}|r�|��d kr�d |_d|_nd |_|��|_d|_|j�d �}|�r`|j�s`zt|�|_Wnt�yJd|_Yn0|jdk�rfd|_nd|_|tk�s�|tk�s�d|k�r�dk�s�n|jdk�r�d|_|j�s�|j�s�|jdu�r�d |_dS)Nrzheaders:)zHTTP/1.0zHTTP/0.9� zHTTP/1.� �header:r+�transfer-encodingrRTF�content-lengthr���HEAD)rArdZCONTINUErBr@rKr]�coderP�striprQrOrarrIrM�items�getr-rRrS� _check_closerUrTrcr`Z NO_CONTENTZ NOT_MODIFIEDrL) r2rOrPrQZskipped_headers�hdr�valZtr_encrTrrr�begin9sd             � � ���zHTTPResponse.begincCsv|j�d�}|jdkr.|r*d|��vr*dSdS|j�d�r>dS|rRd|��vrRdS|j�d�}|rrd|��vrrdSdS)NZ connectionrf�closeTFz keep-alivezproxy-connection)rArorOr-)r2ZconnZpconnrrrrp�s    zHTTPResponse._check_closecCs|j}d|_|��dS�N)r@rt)r2r@rrrrb�szHTTPResponse._close_conncs2zt���W|jr.|��n|jr,|��0dSru)�superrtr@rb�r2�� __class__rrrt�s   �zHTTPResponse.closecst���|jr|j��dSru)rv�flushr@rwrxrrrz�s zHTTPResponse.flushcCsdS)zAlways returns TrueTrrwrrr�readable�szHTTPResponse.readablecCs |jduS)z!True if the connection is closed.N)r@rwrrr�isclosed�szHTTPResponse.isclosedcCs�|jdurdS|jdkr$|��dS|durRt|�}|�|�}t|�d|���S|jr`|��S|j durv|j� �}n4z|� |j �}Wnt y�|���Yn0d|_ |��|SdS)Nrrkr) r@rLrb� bytearray�readinto� memoryview�tobytesrR�_readall_chunkedrT�read� _safe_readr )r2�amt�br3�srrrr��s*      zHTTPResponse.readcCs�|jdurdS|jdkr$|��dS|jr4|�|�S|jdur^t|�|jkr^t|�d|j�}|j�|�}|s||r||��n&|jdur�|j|8_|js�|��|S)z^Read up to len(b) bytes into bytearray b and return the number of bytes read. Nrrk) r@rLrbrR�_readinto_chunkedrTr.rr~)r2r�r3rrrr~�s$       zHTTPResponse.readintocCsp|j�td�}t|�tkr$td��|�d�}|dkrB|d|�}z t|d�WStyj|���Yn0dS)Nr,z chunk size�;r�) r@r=r>r.r�findrcr`rb)r2r4�irrr�_read_next_chunk_sizes     z"HTTPResponse._read_next_chunk_sizecCs:|j�td�}t|�tkr$td��|s*q6|dvrq6qdS)Nr,z trailer liner:)r@r=r>r.r�r2r4rrr�_read_and_discard_trailers z&HTTPResponse._read_and_discard_trailercCsj|j}|sf|dur|�d�z |��}WntyBtd��Yn0|dkr`|��|��d}||_|S)NrZrr)rSr�r�r`r r�rb)r2rSrrr�_get_chunk_left$s   zHTTPResponse._get_chunk_leftcCs`g}z6|��}|durq0|�|�|��d|_qd�|�WStyZtd�|���Yn0dS�Nrr)r�r1r�rSrEr )r2�valuerSrrrr�<s  zHTTPResponse._readall_chunkedcCs�d}t|�}zv|��}|dur$|WSt|�|krN|�|�}|||_||WS|d|�}|�|�}||d�}||7}d|_qWn&ty�tt|d|����Yn0dS)Nr)rr�r.�_safe_readintorSr �bytes)r2r�� total_bytes�mvbrSr3�temp_mvbrrrr�Js"         zHTTPResponse._readinto_chunkedcCsTg}|dkrJ|j�t|t��}|s2td�|�|��|�|�|t|�8}qd�|�S)aVRead the number of bytes requested, compensating for partial reads. Normally, we have a blocking socket, but a read() can be interrupted by a signal (resulting in a partial read). Note that we cannot distinguish between EOF and an interrupt when zero bytes have been read. IncompleteRead() will be raised in this situation. This function should be used when bytes "should" be present for reading. If the bytes are truly not available (due to EOF), then the IncompleteRead exception can be used to detect the problem. rr)r@r��min� MAXAMOUNTr rEr1r.)r2r�r��chunkrrrr�bs zHTTPResponse._safe_readcCs�d}t|�}|t|�kr~tt|�kr>|dt�}|j�|�}n |j�|�}|shtt|d|��t|���||d�}||7}q |S)z2Same as _safe_read, but for reading into a buffer.rN)rr.r�r@r~r r�)r2r�r�r�r�r3rrrr�ys      zHTTPResponse._safe_readinto�����cCs�|jdus|jdkrdS|jr(|�|�S|jdurJ|dksD||jkrJ|j}|j�|�}|sh|rh|��n|jdur�|jt|�8_|S)zvRead with at most one underlying system call. If at least one byte is buffered, return that instead. Nrkrr)r@rLrR�_read1_chunkedrT�read1rbr.)r2r3�resultrrrr��s    zHTTPResponse.read1cCs4|jdus|jdkrdS|jr(|�|�S|j�|�S)Nrkr)r@rLrR� _peek_chunked�peek)r2r3rrrr��s  zHTTPResponse.peekcs�|jdus|jdkrdS|jr*t��|�S|jdurL|dksF||jkrL|j}|j�|�}|sj|rj|��n|jdur�|jt|�8_|S)Nrkrr)r@rLrRrvr=rTrbr.)r2�limitr�rxrrr=�s    zHTTPResponse.readlinecCsd|��}|dus|dkrdSd|kr0|ks6n|}|j�|�}|jt|�8_|s`td��|Sr�)r�r@r�rSr.r )r2r3rSr�rrrr��s zHTTPResponse._read1_chunkedcCsBz |��}Wnty YdS0|dur.dS|j�|�d|�S)Nr)r�r r@r�)r2r3rSrrrr��s  zHTTPResponse._peek_chunkedcCs |j��Sru)r@�filenorwrrrr��szHTTPResponse.filenocCsF|jdurt��|j�|�p|}t|t�s4t|d�s8|Sd�|�SdS)axReturns the value of the header matching *name*. If there are multiple matching headers, the values are combined into a single string separated by commas and spaces. If no matching header is found, returns *default* or None if the *default* is not specified. If the headers are unknown, raises http.client.ResponseNotReady. N�__iter__z, )rArZget_all� isinstancer\�hasattrrE)r2r'�defaultrArrr� getheader�s zHTTPResponse.getheadercCs|jdurt��t|j���S)z&Return list of (header, value) tuples.N)rAr�listrnrwrrr� getheaders�s zHTTPResponse.getheaderscCs|Srurrwrrrr��szHTTPResponse.__iter__cCs|jS)ajReturns an instance of the class mimetools.Message containing meta-information associated with the URL. When the method is HTTP, these headers are those returned by the server at the head of the retrieved HTML page (including Content-Length and Content-Type). When the method is FTP, a Content-Length header will be present if (as is now usual) the server passed back a file length in response to the FTP retrieval request. A Content-Type header will be present if the MIME type can be guessed. When the method is local-file, returned headers will include a Date representing the file's last-modified time, a Content-Length giving file size, and a Content-Type containing a guess at the file's type. See also the description of the mimetools module. )rArwrrr�info�szHTTPResponse.infocCs|jS)aZReturn the real URL of the page. In some cases, the HTTP server redirects a client to another URL. The urlopen() function handles this transparently, but in some cases the caller needs to know which URL the client was redirected to. The geturl() method can be used to get at this redirected URL. )rXrwrrr�geturls zHTTPResponse.geturlcCs|jS)zuReturn the HTTP status code that was sent with the response, or None if the URL is not an HTTP URL. )rPrwrrr�getcodeszHTTPResponse.getcode)rNN)N)r�)r�)r�)N)"r6r7r8rYrdrsrprbrtrzr{r|r�r~r�r�r�r�r�r�r�r�r�r=r�r�r�r�r�r�r�r�r�� __classcell__rrrxrr�s< !H  "     rc@s eZdZdZdZeZeZdZ dZ e dd��Z e dd��Z d ejd d fd d �Zd7d d�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd8d d!�Zd9d"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Z d:dd.�d/d0�Z!d ifdd.�d1d2�Z"d3d4�Z#d5d6�Z$d S);rrfzHTTP/1.1r,rcCs t|tj�S)zFTest whether a file-like object is a text or a binary stream. )r��io� TextIOBase)�streamrrr� _is_textIO%szHTTPConnection._is_textIOcCsd|dur|��tvrdSdSt|d�r*dSzt|�}|jWStyLYn0t|t�r`t|�SdS)aGet the content-length based on the body. If the body is None, we set Content-Length: 0 for methods that expect a body (RFC 7230, Section 3.3.2). We also set the Content-Length for any method if the body is a str or bytes-like object and not a file. Nrr�) �upper�_METHODS_EXPECTING_BODYr�r�nbytes� TypeErrorr�r\r.)�bodyrWZmvrrr�_get_content_length+s    z"HTTPConnection._get_content_lengthN� cCsn||_||_||_d|_g|_d|_t|_d|_d|_ d|_ i|_ |� ||�\|_ |_|�|j �tj|_dSru)�timeout�source_address� blocksizerV�_buffer�_HTTPConnection__response�_CS_IDLE�_HTTPConnection__staterL� _tunnel_host� _tunnel_port�_tunnel_headers� _get_hostport�host�port�_validate_host�socketZcreate_connection�_create_connection)r2r�r�r�r�r�rrrrYKs zHTTPConnection.__init__cCs<|jrtd��|�||�\|_|_|r.||_n |j��dS)aDSet up host and port for HTTP CONNECT tunnelling. In a connection that uses HTTP CONNECT tunneling, the host passed to the constructor is used as a proxy server that relays all communication to the endpoint passed to `set_tunnel`. This done by sending an HTTP CONNECT request to the proxy server when the connection is established. This method must be called before the HTTP connection has been established. The headers argument should be a mapping of extra HTTP headers to send with the CONNECT request. z.Can't set up tunnel for established connectionN)rV� RuntimeErrorr�r�r�r��clear)r2r�r�rArrr� set_tunnelas zHTTPConnection.set_tunnelcCs�|dur�|�d�}|�d�}||kr�zt||dd��}WnFty�||dd�dkrf|j}ntd||dd���Yn0|d|�}n|j}|r�|ddkr�|ddkr�|dd�}||fS) Nr+�]r,r[znonnumeric port: '%s'r�[r�)�rfindrcr`� default_portr )r2r�r�r��jrrrr�ys    zHTTPConnection._get_hostportcCs ||_dSru)rK)r2�levelrrr�set_debuglevel�szHTTPConnection.set_debuglevelc Cs d|j�d�|jf}|g}|j��D]$\}}|�|�d|�d��d��q&|�d�|�d�|��~|j|j |j d�}|� �\}}}|t j jkr�|��td |�d |������|j�td �} t| �tkr�td ��| s��q| d vr�q|jdkr�td| ���q�dS)NsCONNECT %s:%d HTTP/1.0 �asciiz: � rr;r�rWzTunnel connection failed: � r,r9r:rrg)r�r r�r�rnr1�sendrE�response_classrVrLrd�http� HTTPStatusZOKrt�OSErrorrmr@r=r>r.rrKr]rF) r2�connectrA�headerr��responserOrl�messager4rrr�_tunnel�s.�    zHTTPConnection._tunnelc Csz|�|j|jf|j|j�|_z|j�tjtj d�Wn2t yf}z|j t j krR�WYd}~n d}~00|j rv|��dS)z3Connect to the host and port specified in __init__.r,N)r�r�r�r�r�rVZ setsockoptr�Z IPPROTO_TCPZ TCP_NODELAYr��errnoZ ENOPROTOOPTr�r��r2�errrr��s� zHTTPConnection.connectcCsZt|_z4|j}|r d|_|��W|j}|rVd|_|��n|j}|rTd|_|��0dS)z(Close the connection to the HTTP server.N)r�r�rVrtr�)r2rVr�rrrrt�s  �zHTTPConnection.closecCs|jdur |jr|��nt��|jdkr8tdt|��t|d�r�|jdkrTtd�|�|�}|rt|jdkrttd�|� |j �}|s�q�|r�|� d�}|j� |�qtdSz|j� |�WnHt y�t|tjj�r�|D]}|j� |�q�nt dt|���Yn0dS) z�Send `data' to the server. ``data`` can be a string object, a bytes object, an array object, a file-like object that supports a .read() method, or an iterable object. Nrzsend:r��sendIng a read()able�encoding file using iso-8859-1rCz9data should be a bytes-like object or an iterable, got %r)rV� auto_openr�rrKr]r^r�r�r�r�r Zsendallr�r�� collections�abc�Iterable�type)r2rr � datablock�drrrr��s8         �zHTTPConnection.sendcCs|j�|�dS)zuAdd a line of output to the current request buffer. Assumes that the line does *not* end with \r\n. N)r�r1)r2r�rrr�_output�szHTTPConnection._outputccs^|jdkrtd�|�|�}|r2|jdkr2td�|�|j�}|sDqZ|rR|�d�}|Vq2dS)Nrr�r�rC)rKr]r�r�r�r )r2r{r r�rrr�_read_readable�s    zHTTPConnection._read_readableFc Cs|j�d�d�|j�}|jdd�=|�|�|du�rt|d�rN|�|�}nVz t|�WnBty�z t|�}Wn"ty�tdt |���Yn0Yn0|f}|D]R}|s�|j dkr�t d�q�|r�|j dkr�t |�d �d ��d �|d}|�|�q�|�r|j dk�r|�d �dS) z�Send the currently buffered request and clear the buffer. Appends an extra \r\n to the buffer. A message_body may be specified, to be appended to the request. )rrr;Nr�zAmessage_body should be a bytes-like object or an iterable, got %rrzZero length chunk ignoredrf�Xr�r�s0 )r��extendrEr�r�r�rr��iterr�rKr]� _http_vsnr.r )r2� message_body�encode_chunkedrMZchunksr�rrr� _send_outputs:           � � zHTTPConnection._send_outputc Cs�|jr|j��rd|_|jtkr(t|_n t|j��|�|�||_|pHd}|�|�d|||j f}|� |� |��|j dk�r�|�s�d}|� d�r�t|�\}}}}}|r�z|�d�}Wnty�|�d�}Yn0|�d |�n�|jr�|j} |j} n |j} |j} z| �d�} Wnt�y0| �d�} Yn0| �d �d k�rNd | d } | |jk�rh|�d | �n| �d�} |�d d| | f�|�s�|�dd�ndS)a`Send a request to the server. `method' specifies an HTTP request method, e.g. 'GET'. `url' specifies the object being requested, e.g. '/index.html'. `skip_host' if True does not add automatically a 'Host:' header `skip_accept_encoding' if True does not add automatically an 'Accept-Encoding:' header N�/z%s %s %srfr[r�r�ZidnaZHostr+r�[�]z%s:%szAccept-EncodingZidentity)r�r|r�r��_CS_REQ_STARTEDr �_validate_methodrL�_validate_path� _http_vsn_strr��_encode_requestr�rarr r!� putheaderr�r�r�r�r�r�rF) r2rWrX� skip_host�skip_accept_encoding�requestZnetlocZnilZ netloc_encr�r�Zhost_encrrr� putrequest=sP             zHTTPConnection.putrequestcCs |�d�S)Nr�)r )r2rrrrr��szHTTPConnection._encode_requestcCs,t�|�}|r(td|�d|���d���dS)z&Validate a method name for putrequest.z)method can't contain control characters. � (found at least �)N)�$_contains_disallowed_method_pchar_re�searchr`�group)r2rW�matchrrrr��s ��zHTTPConnection._validate_methodcCs,t�|�}|r(td|�d|���d���dS)zValidate a url for putrequest.�&URL can't contain control characters. rrN��!_contains_disallowed_url_pchar_rerr r)r2rXrrrrr��s   �zHTTPConnection._validate_pathcCs,t�|�}|r(td|�d|���d���dS)z9Validate a host so it doesn't contain control characters.rrrNr )r2r�rrrrr��s   �zHTTPConnection._validate_hostcGs�|jtkrt��t|d�r$|�d�}t|�s:td|f��t|�}t|�D]\\}}t|d�rl|�d�||<nt |t �r�t |��d�||<t ||�rJtd||f��qJd� |�}|d|}|�|�dS) zkSend a request header line to the server. For example: h.putheader('Accept', 'text/html') r r�zInvalid header name %rrzInvalid header value %rs s: N)r�r�rr�r �_is_legal_header_namer`r�� enumerater�rcr\�_is_illegal_header_valuerEr�)r2r��valuesr�Z one_valuer�rrrr��s"        zHTTPConnection.putheader�r�cCs*|jtkrt|_nt��|j||d�dS)z�Indicate that the last header line has been sent to the server. This method sends the request to the server. The optional message_body argument can be used to pass a message body associated with the request. rN)r�r�� _CS_REQ_SENTrr�)r2r�r�rrr� endheaders�s zHTTPConnection.endheaderscCs|�|||||�dS)z&Send a complete request to the server.N)� _send_request)r2rWrXr�rAr�rrrrszHTTPConnection.requestc Cs�tdd�|D��}i}d|vr&d|d<d|vr6d|d<|j||fi|��d|vr�d |vr�d }|�||�}|dur�|dur�|jd kr�td |�d }|�dd�q�|�dt|��nd }|��D]\} } |�| | �q�t|t�r�t |d�}|j ||d�dS)Ncss|]}|��VqdSru)r-)r�krrr� rz/HTTPConnection._send_request..r�r,r�zaccept-encodingr�rirhFrzUnable to determine size of %rTzTransfer-EncodingrRzContent-Lengthr�r) � frozensetrr�rKr]r�r\rnr�r)r) r2rWrXr�rAr�Z header_namesZskipsZcontent_lengthrqr�rrrrs0      zHTTPConnection._send_requestcCs�|jr|j��rd|_|jtks&|jr0t|j��|jdkrR|j|j|j|jd�}n|j|j|jd�}zLz |� �Wnt y�|� ��Yn0t |_|j r�|� �n||_|WS|� ��Yn0dS)a)Get the response from the server. If the HTTPConnection is in the correct state, returns an instance of HTTPResponse or of whatever object is returned by the response_class variable. If a request has not been sent or if a previous response has not be handled, ResponseNotReady is raised. If the HTTP response indicates that the connection should be closed, then it will be closed before the response is returned. When the connection is closed, the underlying socket is closed. Nrr�)r�r|r�rrrKr�rVrLrs�ConnectionErrorrtr�rU)r2r�rrr� getresponse5s.   �   zHTTPConnection.getresponse)NN)NF)FF)N)%r6r7r8r�r�rr�� HTTP_PORTr�r�rK� staticmethodr�r�r��_GLOBAL_DEFAULT_TIMEOUTrYr�r�r�r�r�rtr�r�r�r�rr�r�r�r�r�rrrrrrrrrsJ  �   & 6�   � .rcsHeZdZdZeZdddejdfdddd��fdd� Z�fdd�Z �Z S) �HTTPSConnectionz(This class allows communication via SSL.Nr�)�context�check_hostnamer�c s�tt|�j||||| d�|dus2|dus2|durHddl} | �dtd�||_||_|durtt� �}|j durtd|_ |j tj k} |dur�|j }|r�| s�td��|s�|r�|�||�|j dur�d|_ ||_|dur�||j_ dS)N)r�rzTkey_file, cert_file and check_hostname are deprecated, use a custom context instead.rZTzMcheck_hostname needs a SSL context with either CERT_OPTIONAL or CERT_REQUIRED)rvrrY�warnings�warn�DeprecationWarning�key_file� cert_file�sslZ_create_default_https_contextZpost_handshake_authZ verify_modeZ CERT_NONErr`Zload_cert_chain�_context) r2r�r�r!r"r�r�rrr�rZ will_verifyrxrrrY�s:���    zHTTPSConnection.__init__cs6t���|jr|j}n|j}|jj|j|d�|_dS)z(Connect to a host on a given (SSL) port.)�server_hostnameN)rvr�r�r�r$Z wrap_socketrV)r2r%rxrrr��s  �zHTTPSConnection.connect) r6r7r8�__doc__� HTTPS_PORTr�r�rrYr�r�rrrxrrys��$rc@s eZdZdS)rN�r6r7r8rrrrr�src@s eZdZdS)rNr(rrrrr�src@s eZdZdS)r Nr(rrrrr �sr c@seZdZdd�ZdS)rcCs|f|_||_dSru)�argsrO)r2rOrrrrY�szUnknownProtocol.__init__N�r6r7r8rYrrrrr�src@s eZdZdS)rNr(rrrrr�src@s eZdZdS)r Nr(rrrrr �sr c@s$eZdZddd�Zdd�ZejZdS)r NcCs|f|_||_||_dSru)r)�partial�expected)r2r+r,rrrrY�szIncompleteRead.__init__cCs2|jdurd|j}nd}d|jjt|j�|fS)Nz, %i more expectedr[z%s(%i bytes read%s))r,ryr6r.r+r�rrr�__repr__�s    �zIncompleteRead.__repr__)N)r6r7r8rYr-r#�__str__rrrrr �s r c@s eZdZdS)r Nr(rrrrr �sr c@s eZdZdS)r Nr(rrrrr �sr c@s eZdZdS)rNr(rrrrr�src@s eZdZdS)rNr(rrrrr�src@seZdZdd�ZdS)rcCs|s t|�}|f|_||_dSru)r^r)r4r�rrrrY�szBadStatusLine.__init__Nr*rrrrr�src@seZdZdd�ZdS)rcCst�|dt|f�dS)Nz&got more than %d bytes when reading %s)rrYr>)r2Z line_typerrrrY�s�zLineTooLong.__init__Nr*rrrrr�src@seZdZdd�ZdS)rcOs(t�|d�tj|g|�Ri|��dS)Nr[)rrY�ConnectionResetError)r2�pos�kwrrrrY�s zRemoteDisconnected.__init__Nr*rrrrr�sr)r)Cr&Z email.parserrGZ email.messager�r�r��rer��collections.abcr�Z urllib.parser�__all__rr'rNr�r�r�globals�updater�� __members__rrr�r>r?�compile� fullmatchr rr r rr�r)r�ZMessager*rBrI�BufferedIOBaserrr#� ImportErrorrr1� Exceptionrrr rrr r r r rrrrr/rrrrrr�szF       .] 8