Your IP : 18.119.109.229


Current Path : /opt/alt/python313/lib64/python3.13/http/__pycache__/
Upload File :
Current File : //opt/alt/python313/lib64/python3.13/http/__pycache__/client.cpython-313.pyc

�

*}g����p�SrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSK	r	SSK
rSSKJ
r
 /SQrSrSrSrSrS	rS
r\"5R-\R.R05 \R.R0R35Vs0sHoUR4_M snrSrSr\R<"S
5R>r \R<"S5RBr"\R<"S5r#\R<"S5r$1Skr%S>Sjr&S\'S\'4Sjr("SS\RRRT5r+Sr,\+4Sjr-\+4Sjr."SS\R^5r0Sr1"SS5r2SSK3r3"S S!\25r4\RkS!5 "S"S#\75r8"S$S%\85r9"S&S'\85r:"S(S)\85r;"S*S+\85r<"S,S-\85r="S.S/\85r>"S0S1\85r?"S2S3\?5r@"S4S5\?5rA"S6S7\?5rB"S8S9\85rC"S:S;\85rD"S<S=\E\C5rF\8rGgs snf!\6a N�f=f)?a�
HTTP/1.1 client library

<intro stuff goes here>
<other stuff, too>

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           <response_class>
Req-started-unread-response    _CS_REQ_STARTED    <response_class>
Req-sent-unread-response       _CS_REQ_SENT       <response_class>
�N)�urlsplit)�HTTPResponse�HTTPConnection�
HTTPException�NotConnected�UnknownProtocol�UnknownTransferEncoding�UnimplementedFileMode�IncompleteRead�
InvalidURL�ImproperConnectionState�CannotSendRequest�CannotSendHeader�ResponseNotReady�
BadStatusLine�LineTooLong�RemoteDisconnected�error�	responses�Pi��UNKNOWN�IdlezRequest-startedzRequest-senti�ds[^:\s][^:\r\n]*s\n(?![ \t])|\r(?![ \t\n])z[- ]z[-]>�PUT�POST�PATCHc
��URS5$![ann[URURURUR
UR
5<SXRUR
<SSU<S35SeSnAff=f)z<Call data.encode("latin-1") but show a better error message.�latin-1z (z.20z) is not valid Latin-1. Use z9.encode('utf-8') if you want to send it encoded in UTF-8.N)�encode�UnicodeEncodeError�encoding�object�start�end�title)�data�name�errs   �2/opt/alt/python313/lib64/python3.13/http/client.py�_encoder*�s{��
E��{�{�9�%�%���E� ��L�L��J�J��I�I��G�G��Z�Z�\�4�	�	�#�'�'�2�D�
:�;�AE�	E��E�s��
B�A)B�B�enc_name�returnc��URS5upnU(a"URS5(dU5eUS-
nU$)z)Remove interface scope from IPv6 address.�%�[�])�	partition�
startswith)r+�percent�_s   r)�_strip_ipv6_ifacer5�sE��#�-�-�d�3��H�q���"�"�4�(�(�2�(�2�(��D����O�c��\rSrSrSrSrg)�HTTPMessage�c��UR5S-n[U5n/nSnUR5HQnUSUR5U:XaSnOUSSR5(dSnU(dM@UR	U5 MS U$)a�Find all header lines matching a given header name.

Look through the list of headers and find all lines matching a given
header name (and their continuation lines).  A list of the lines is
returned, without interpretation.  If the header does not occur, an
empty list is returned.  If the header occurs multiple times, all
occurrences are returned.  Case is not important in the header name.

�:rN�)�lower�len�keys�isspace�append)�selfr'�n�lst�hit�lines      r)�getallmatchingheaders�!HTTPMessage.getallmatchingheaders�s����z�z�|�c�!����I�������I�I�K�D��B�Q�x�~�~��4�'����"�1�X�%�%�'�'����s��
�
�4� �
 ��
r6�N)�__name__�
__module__�__qualname__�__firstlineno__rG�__static_attributes__rIr6r)r8r8�s��r6r8c��/nUR[S-5n[U5[:�a[S5eUR	U5 [U5[
:�a[
S[
-5eUS;aU$Mw)z�Reads potential header lines into a list from a file pointer.

Length of line is limited by _MAXLINE, and number of
headers is limited by _MAXHEADERS.
r<zheader linezgot more than %d headers��
�
r6)�readline�_MAXLINEr>rrA�_MAXHEADERSr)�fp�headersrFs   r)�
_read_headersrX�st���G�
��{�{�8�a�<�(���t�9�x���m�,�,����t���w�<�+�%�� :�[� H�I�I��(�(���N�r6c��SRU5RS5n[RR	US9RU5$)a.
Parses only RFC2822 headers from header lines.

email Parser wants to see strings rather than bytes.
But a TextIOWrapper around self.rfile would buffer too many bytes
from the stream, bytes which we later need to read as bytes.
So we read the correct bytes here, as bytes, for email Parser
to parse.

r6�
iso-8859-1)�_class)�join�decode�email�parser�Parser�parsestr)�header_linesr[�hstrings   r)�_parse_header_linesrd�s@���h�h�|�$�+�+�L�9�G��<�<���f��-�6�6�w�?�?r6c�.�[U5n[X!5$)z0Parses only RFC2822 headers from a file pointer.)rXrd)rVr[rWs   r)�
parse_headersrf�s���B��G��w�/�/r6c�^�\rSrSrS!SjrSrSrSrSrU4Sjr	U4Sjr
S	rS
rS"Sjr
SrS
rSrSrS"SjrSrSrSrS#SjrS#SjrS#U4SjjrSrSrSrS"SjrSrSrSrSr Sr!S r"U=r#$)$r�c��URS5UlX lX0lS=UlUl[Ul[Ul[Ul	[Ul
[Ul[Ul[Ul
g)N�rb)�makefilerV�
debuglevel�_methodrW�msg�_UNKNOWN�version�status�reason�chunked�
chunk_left�length�
will_close)rB�sockrl�method�urls     r)�__init__�HTTPResponse.__init__sa���-�-��%���$����#'�&���t�x� ������������"������"��r6c��[URR[S-5S5n[	U5[:�a[S5eURS:�a[S[U55 U(d[S5eURSS5up#nURS	5(dUR5 [U5e[W5nUS
:dUS:�a[U5eX#W4$![a- URSS5up#SnN|![a SnN�f=ff=f![a [U5ef=f)Nr<rZzstatus linerzreply:z-Remote end closed connection without response��zHTTP/ri�)�strrVrSrTr>rrl�print�reprr�split�
ValueErrorr2�_close_connr�int)rBrFrprqrrs     r)�_read_status�HTTPResponse._read_status#sA���4�7�7�#�#�H�q�L�1�<�@���t�9�x���m�,�,��?�?�Q���(�D��J�'��%�&1�2�
2�	�&*�j�j��q�&9�#�G�V��!�!�'�*�*�������%�%�	&���[�F���|�v��|�#�D�)�)� ,���&�&��%�	�
�"&�*�*�T�1�"5�������
���
��		�� �	&���%�%�	&�s6�C1�
"D+�1
D(�<D�D$� D(�#D$�$D(�+Ec���URbgUR5upnU[:waO4[UR5nUR
S:�a[
SU5 AMRU=UlUlUR5Ul
US;aSUlO)URS5(aSUlO[U5e[UR5=UlUlUR
S:�a3URR!5HupV[
SUS	-U5 M URR#S
5nU(a#UR%5S:XaSUlSUlOSUlUR+5UlSUlURR#S
5nU(a:UR&(d)[1U5UlUR.S:aSUlOSUlU[4:Xd)U[6:XdSUs=::aS:dO UR8S:XaSUlUR,(d(UR&(dUR.cSUlgggg![2a
 SUlN�f=f)NTrzheaders:)zHTTP/1.0zHTTP/0.9�
zHTTP/1.��header:r;�transfer-encodingrsF�content-lengthr���HEAD)rWr��CONTINUErXrVrlr��coderq�striprrrpr2rrfrn�items�getr=rsrt�_check_closervrur�r��
NO_CONTENT�NOT_MODIFIEDrm)	rBrprqrr�skipped_headers�hdr�val�tr_encrus	         r)�begin�HTTPResponse.beginDs���<�<�#���&*�&7�&7�&9�#�G�V���!��+�D�G�G�4�O�����"��j�/�2���#)�(��	�D�K��l�l�n����.�.��D�L�
�
�
�	�
*�
*��D�L�!�'�*�*�"/����"8�8���t�x��?�?�Q�� �L�L�.�.�0����i��s��C�0�1����!�!�"5�6���f�l�l�n�	�1��D�L�"�D�O� �D�L��+�+�-���������!�!�"2�3���$�,�,�
'�!�&�k����;�;��?�"&�D�K���D�K�
�j� �F�l�$:��6��C���L�L�F�"��D�K�
�������K�K��"�D�O�
 �� ��#�
#�"���
#�s�<I�I3�2I3c�|�URRS5nURS:XaU(aSUR5;aggURRS5(agU(aSUR5;agURRS5nU(aSUR5;agg)N�
connectionr��closeTFz
keep-alivezproxy-connection)rWr�rpr=)rB�conn�pconns   r)r��HTTPResponse._check_close�s����|�|����-���<�<�2����4�:�:�<�/����<�<���L�)�)���L�D�J�J�L�0����� � �!3�4���\�U�[�[�]�2��r6c�J�URnSUlUR5 g�N)rVr�)rBrVs  r)r��HTTPResponse._close_conn�s��
�W�W�����
���
r6c�>�[TU]5 UR(aUR5 gg!UR(aUR5 ff=fr�)�superr�rVr��rB�	__class__s �r)r��HTTPResponse.close�sB���	#��G�M�O��w�w�� � �"���t�w�w�� � �"��s	�4�$Ac�z>�[TU]5 UR(aURR5 ggr�)r��flushrVr�s �r)r��HTTPResponse.flush�s%���
��
���7�7��G�G�M�M�O�r6c��g)zAlways returns TrueTrI�rBs r)�readable�HTTPResponse.readable�s��r6c��URSL$)z!True if the connection is closed.N)rVr�s r)�isclosed�HTTPResponse.isclosed�s���w�w�$��r6c��URcgURS:XaUR5 gUR(aUR	U5$Ub�UR
bXR
:�aUR
nURR
U5nU(dU(aUR5 U$UR
b?U=R
[U5-slUR
(dUR5 U$UR
cURR
5nO#URUR
5nSUlUR5 U$![a UR5 ef=f)z?Read and return the response body, or up to the next amt bytes.r6r�r)
rVrmr�rs�
_read_chunkedru�readr>�
_safe_readr)rB�amt�ss   r)r��HTTPResponse.read�s0���7�7�?���<�<�6�!�������<�<��%�%�c�*�*��?��{�{�&�3���+<��k�k�������S�!�A���� � �"�
�H�	���(����s�1�v�%���{�{��$�$�&��H��{�{�"��G�G�L�L�N���������4�A� ��������H��&���$�$�&���s�/E#�#E?c� �URcgURS:XaUR5 gUR(aUR	U5$UR
b1[
U5UR
:�a[U5SUR
nURRU5nU(dU(aUR5 U$UR
b6U=R
U-slUR
(dUR5 U$)zNRead up to len(b) bytes into bytearray b and return the number
of bytes read.
rr�)	rVrmr�rs�_readinto_chunkedrur>�
memoryview�readinto)rB�brCs   r)r��HTTPResponse.readinto�s���
�7�7�?���<�<�6�!�������<�<��)�)�!�,�,��;�;�"��1�v����#��q�M�!�D�K�K�0��

�G�G���Q����Q�
����
��	�[�[�
$��K�K�1��K��;�;�� � �"��r6c��URR[S-5n[U5[:�a[	S5eURS5nUS:�aUSUn[
US5$![a UR5 ef=f)Nr<z
chunk size�;r�)	rVrSrTr>r�findr�r�r�)rBrF�is   r)�_read_next_chunk_size�"HTTPResponse._read_next_chunk_sizes����w�w����1��-���t�9�x���l�+�+��I�I�d�O����6����8�D�	��t�R�=� ���	�
�����		�s�A*�*Bc��URR[S-5n[U5[:�a[	S5eU(dgUS;agMQ)Nr<ztrailer linerP)rVrSrTr>r�rBrFs  r)�_read_and_discard_trailer�&HTTPResponse._read_and_discard_trailer)sO����7�7�#�#�H�q�L�1�D��4�y�8�#�!�.�1�1����,�,��r6c��URnU(dSUbURS5 UR5nUS:Xa"UR5 UR
5 SnXlU$![a [	S5ef=f)Nr}r6r)rtr�r�r�rr�r�)rBrts  r)�_get_chunk_left�HTTPResponse._get_chunk_left7s����_�_�
���%�����"�
*�!�7�7�9�
��Q���.�.�0�� � �"�!�
�(�O�����
*�$�S�)�)�
*�s�A)�)A?c��UR[:wde/nUR5=nbuUb/X::a*URUR	U55 X1-
UlOCURUR	U55 UbX-nSUlUR5=nbMuSR
U5$![a n[SR
U55UeSnAff=f�Nrr6)rsror�rAr�rtr\r)rBr��valuert�excs     r)r��HTTPResponse._read_chunkedOs����|�|�x�'�'�'���
	;�!%�!5�!5�!7�7�:�D��?�s�'8��L�L�����!5�6�&0�&6�D�O�����T�_�_�Z�8�9��?��%�C�"#���"&�!5�!5�!7�7�:�D��8�8�E�?�"���	;� ����%��1�s�:��	;�s�BB3�"B3�3
C�=C�Cc�h�UR[:wdeSn[U5nUR5nUcU$[	U5U::aURU5nXE-
UlX%-$USUnURU5nX5SnX%-
nSUlMi![a [[USU55ef=f)Nr)	rsror�r�r>�_safe_readintortr�bytes)rBr��total_bytes�mvbrtrC�temp_mvbs       r)r��HTTPResponse._readinto_chunkedas����|�|�x�'�'�'�����m��	:��!�1�1�3�
��%�&�&��s�8�z�)��+�+�C�0�A�&0�n�D�O�&�?�*��{�
�+���'�'��1���"�g��� ��"#����� �	:� ��q��;�'7�!8�9�9�	:�s�B�,B�('B�"B1c��URRU5n[U5U:a[X![U5-
5eU$)z�Read the number of bytes requested.

This function should be used when <amt> 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.
)rVr�r>r)rBr�r&s   r)r��HTTPResponse._safe_readys9���w�w�|�|�C� ���t�9�s�?� ��3�t�9�}�5�5��r6c��[U5nURRU5nX2:a[[	USU5X#-
5eU$)z2Same as _safe_read, but for reading into a buffer.N)r>rVr�rr�)rBr�r�rCs    r)r��HTTPResponse._safe_readinto�sB���!�f���G�G���Q����7� ��q��!�u��s�u�5�5��r6c���URbURS:XagUR(aURU5$URb!US:dXR:�aURnURRU5nU(dU(aUR
5 U$URb?U=R[U5-slUR(dUR
5 U$)zfRead with at most one underlying system call.  If at least one
byte is buffered, return that instead.
r�r6r)rVrmrs�_read1_chunkedru�read1r�r>)rBrC�results   r)r��HTTPResponse.read1�s����7�7�?�d�l�l�f�4���<�<��&�&�q�)�)��;�;�"��A���[�[�����A������q�!���!�����
�
�	�[�[�
$��K�K�3�v�;�&�K��;�;�� � �"��
r6c��URbURS:XagUR(aURU5$URR	U5$)Nr�r6)rVrmrs�
_peek_chunked�peek)rBrCs  r)r��HTTPResponse.peek�sE���7�7�?�d�l�l�f�4���<�<��%�%�a�(�(��w�w�|�|�A��r6c��>�URbURS:XagUR(a[TU]U5$UR
b!US:dXR
:�aUR
nURR	U5nU(dU(aUR
5 U$UR
b?U=R
[U5-slUR
(dUR
5 U$)Nr�r6r)rVrmrsr�rSrur�r>)rB�limitr�r�s   �r)rS�HTTPResponse.readline�s�����7�7�?�d�l�l�f�4���<�<��7�#�E�*�*��;�;�"���	�U�[�[�5H��K�K�E����!�!�%�(���%�����
�
�	�[�[�
$��K�K�3�v�;�&�K��;�;�� � �"��
r6c���UR5nUbUS:XagSUs=::aU::dO UnURRU5nU=R[	U5-slU(d[S5eU$r�)r�rVr�rtr>r)rBrCrtr�s    r)r��HTTPResponse._read1_chunked�sj���)�)�+�
����a����Q�$�*�$��A��w�w�}�}�Q������3�t�9�$��� ��%�%��r6c��UR5nUcgURRU5SU$![a gf=f)Nr6)r�rrVr�)rBrCrts   r)r��HTTPResponse._peek_chunked�sP��	��-�-�/�J�����w�w�|�|�J�'���4�4��
�	��	�s�4�
A�Ac�6�URR5$r�)rV�filenor�s r)r��HTTPResponse.fileno�s���w�w�~�~��r6c���URc
[5eURRU5=(d Un[U[5(d[US5(dU$SR
U5$)aHReturns 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.

�__iter__z, )rWr�get_all�
isinstancer�hasattrr\)rBr'�defaultrWs    r)�	getheader�HTTPResponse.getheader�s]���<�<��"�$�$��,�,�&�&�t�,�7����g�s�#�#�7�7�J�+G�+G��N��9�9�W�%�%r6c�v�URc
[5e[URR55$)z&Return list of (header, value) tuples.)rWr�listr�r�s r)�
getheaders�HTTPResponse.getheaders�s-���<�<��"�$�$��D�L�L�&�&�(�)�)r6c��U$r�rIr�s r)r��HTTPResponse.__iter__�s���r6c��UR$)a�Returns 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.

)rWr�s r)�info�HTTPResponse.info�s��*�|�|�r6c��UR$)a*Return 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.

)ryr�s r)�geturl�HTTPResponse.geturls
���x�x�r6c��UR$)zeReturn the HTTP status code that was sent with the response,
or None if the URL is not an HTTP URL.

)rqr�s r)�getcode�HTTPResponse.getcodes��
�{�{�r6)
rmrtrsr�rlrVrWrurnrrrqrprv)rNNr�)���)$rJrKrLrMrzr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rSr�r�r�r�r�r�rrr	rN�
__classcell__�r�s@r)rr�s����#�<'�BF#�P�:�
#��
��&�P �D� ��0;�$:�0
���&��"�5� �&�(*��
�.
��r6rc��[R"5nUS:XaURS/5 URbSUlU$)Nr�zhttp/1.1T)�ssl�_create_default_https_context�set_alpn_protocols�post_handshake_auth)�http_version�contexts  r)�_create_https_contextr$sC���/�/�1�G��r���"�"�J�<�0��"�"�.�&*��#��Nr6c�"�\rSrSrSrSr\r\r	Sr
Sr\S5r
\S5rS\R SS	4S
jrS$SjrSrS
rSrSrSrSrSrSrSrSrS%SjrS&SjrSrSr Sr!Sr"Sr#S'SS.Sjjr$S04SS.S jjr%S!r&S"r'S#r(g)(ri1r�zHTTP/1.1r<rc�6�[U[R5$)zFTest whether a file-like object is a text or a binary stream.
        )r��io�
TextIOBase)�streams r)�
_is_textIO�HTTPConnection._is_textIO;s���&�"�-�-�0�0r6c���UcUR5[;agg[US5(ag[U5nUR$![
a Of=f[
U[5(a[U5$g)z�Get 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�rr>)�bodyrx�mvs   r)�_get_content_length�"HTTPConnection._get_content_lengthAsw���<��|�|�~�!8�8����4�� � ��	��D�!�B��9�9����	��	���d�C� � ��t�9��s�A�
A�AN� c�J�X0lX@lXPlSUl/UlSUl[UlSUlSUl	SUl
0UlSUlURX5uUlUlUR!UR5 ["R$Ulgr�)�timeout�source_address�	blocksizerw�_buffer�_HTTPConnection__response�_CS_IDLE�_HTTPConnection__staterm�_tunnel_host�_tunnel_port�_tunnel_headers�_raw_proxy_headers�
_get_hostport�host�port�_validate_host�socket�create_connection�_create_connection)rBr4r5r(r)r*s      r)rz�HTTPConnection.__init__as�����,��"����	������������� ��� ���!���"&���!%�!3�!3�D�!?����D�I����D�I�I�&�#)�":�":��r6c��UR(a[S5eURX5uUlUlU(aUR5UlOURR5 [SUR55(dHURRS5RS5nSX@R4-URS'gg)aySet up host and port for HTTP CONNECT tunnelling.

In a connection that uses HTTP CONNECT tunnelling, 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.

As HTTP/1.1 is used for HTTP CONNECT tunnelling request, as per the RFC
(https://tools.ietf.org/html/rfc7231#section-4.3.6), a HTTP Host:
header must be provided, matching the authority-form of the request
target provided as the destination for the CONNECT request. If a
HTTP Host: header is not provided via the headers argument, one
is generated and transmitted automatically.
z.Can't set up tunnel for established connectionc3�F# �UHoR5S:Hv� M g7f)r4N�r=)�.0�headers  r)�	<genexpr>�,HTTPConnection.set_tunnel.<locals>.<genexpr>�s���O�:N��<�<�>�V�+�:N�s�!�idna�asciiz%s:%d�HostN)rw�RuntimeErrorr3r/r0�copyr1�clear�anyrr])rBr4r5rW�encoded_hosts     r)�
set_tunnel�HTTPConnection.set_tunnelxs���,�9�9��O�P�P�/3�/A�/A�$�/M�,���4�,��#*�<�<�>�D� �� � �&�&�(��O�$�:N�:N�O�O�O��,�,�3�3�F�;�B�B�7�K�L�+2��/�/�61�,1�D� � ��(�Pr6c�R�UcJURS5nURS5nX4:�a[XS-S5nUSUnOURnU(aUSS:XaUSS:XaUSSnX4$![a- XS-SS:XaURnNV[	SXS-S-5ef=f)	Nr;�]r<r~znonnumeric port: '%s'r�[r)�rfindr�r��default_portr)rBr4r5r��js     r)r3�HTTPConnection._get_hostport�s����<��
�
�3��A��
�
�3��A��u�O��t�a�C�D�z�?�D��B�Q�x���(�(���D��G�s�N�t�B�x�3����"�:�D��|���"�O��a�C�D�z�R�'�#�0�0��(�)@�4�!���:�)M�N�N�	O�s�A/�/!B&�B&c��Xlgr�)rl)rB�levels  r)�set_debuglevel�HTTPConnection.set_debuglevel�s���r6c�4�SU;aUSS:waSU-S-$U$)N�:r�[r/r0rI)rB�ips  r)�
_wrap_ipv6�HTTPConnection._wrap_ipv6�s(���2�:�"�Q�%�7�*��"�9�t�#�#��	r6c��SURURRS55URURRS54-nU/nUR
R
5H+up4URUSUS3RS55 M- URS5 URSRU55 AURURURS	9nUR5upgn[UR5UlUR"S
:�a-UR Hn[%SUR'55 M U[(R*R,:wa/UR/5 [1SUS
UR3535eUR/5 g!UR/5 f=f)NsCONNECT %s:%d %s
rBrCz: �
rrQr6�rxrr�zTunnel connection failed: � )r[r/rr0�
_http_vsn_strr1r�rA�sendr\�response_classrwrmr�rXrVr2rlr�r]�http�
HTTPStatus�OKr��OSErrorr�)	rB�connectrWr?r��responserpr��messages	         r)�_tunnel�HTTPConnection._tunnel�s���)��O�O�D�-�-�4�4�V�<�=�������%�%�g�.�-0�0���)��!�1�1�7�7�9�M�F��N�N�f�X�R��w�d�3�:�:�9�E�F�:����w��	
�	�	�#�(�(�7�#�$���&�&�t�y�y����&�F��	�'/�'<�'<�'>�$�W�G�&3�H�K�K�&@�D�#�����"�"�5�5�F��)�V�]�]�_�5�6��t���)�)�)��
�
��� :�4�&��'�-�-�/�AR�S�T�T�*�

�N�N���H�N�N��s
�7B7G�Gc�J�URb[UR5$S$)z�
Returns a dictionary with the headers of the response
received from the proxy server to the CONNECT request
sent to set the tunnel.

If the CONNECT request was not sent, the method returns None.
N)r2rdr�s r)�get_proxy_response_headers�)HTTPConnection.get_proxy_response_headers�s/���&�&�2�
 �� 7� 7�8�	
��	
r6c��[R"SXRUR5 UR	URUR4UR
UR5UlURR[R[RS5 UR(aUR!5 gg![a)nUR[R:waeSnANQSnAff=f)z3Connect to the host and port specified in __init__.zhttp.client.connectr<N)�sys�auditr4r5r9r(r)rw�
setsockoptr7�IPPROTO_TCP�TCP_NODELAYrg�errno�ENOPROTOOPTr/rk�rB�es  r)rh�HTTPConnection.connect�s����	�	�'��y�y�$�)�)�D��+�+�
�Y�Y�t�y�y�!�4�<�<��1D�1D�F��	�	��I�I� � ��!3�!3�V�5G�5G��K�
����L�L�N���	�	��w�w�%�+�+�+��,��	�s�09C�
C?�C:�:C?c�&�[UlURnU(aSUlUR5 URnU(aSUlUR5 gg!URnU(aSUlUR5 ff=f)z(Close the connection to the HTTP server.N)r-r.rwr�r,)rBrwris   r)r��HTTPConnection.close�sr�����		!��9�9�D�� ��	��
�
�����H��"&������ ������H��"&������ ��s�*A#�#-Bc���URc,UR(aUR5 O
[5eURS:�a[S[
U55 [US5(a�URS:�a[S5 URU5nU(aURS:�a[S5 URUR5=n(anU(aURS5n[R"SX5 URRU5 URUR5=n(aMng[R"SX5 URRU5 g![ag [!U["R$R&5(a&UHnURRU5 M  g[S	[)U5-5ef=f)
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�zsending a readable�encoding file using iso-8859-1rZzhttp.client.sendz9data should be a bytes-like object or an iterable, got %r)rw�	auto_openrhrrlr�r�r�rr�r*rrqrr�sendallr!r��collections�abc�Iterable�type)rBr&r�	datablock�ds     r)rb�HTTPConnection.sends����9�9���~�~�����"�n�$��?�?�Q���'�4��:�&��4�� � �����"��*�+��_�_�T�*�F��$�/�/�A�-��6�7�#�y�y����8�8�)�8�� )� 0� 0�� >�I��	�	�,�d�>��	�	�!�!�)�,�	 $�y�y����8�8�)�8�

��	�	�$�d�1�	G��I�I���d�#���	G��$���� 8� 8�9�9��A��I�I�%�%�a�(�� �!9�;?��:�!F�G�G�	G�s�'F�AG4�G4c�:�URRU5 g)zeAdd a line of output to the current request buffer.

Assumes that the line does *not* end with \r\n.
N)r+rA)rBr�s  r)�_output�HTTPConnection._output(s��
	
�����A�r6c#�n# �URS:�a[S5 URU5nU(aURS:�a[S5 URUR5=n(aAU(aURS5nUv� URUR5=n(aM@gg7f)Nrzreading a readabler~rZ)rlr�rr�r*r)rBr�rr�s    r)�_read_readable�HTTPConnection._read_readable/s�����?�?�Q���&�'�����*���d�o�o��)��2�3�#�=�=����8�8�i�8��%�,�,�\�:�	��O�$�=�=����8�8�i�8�8�s�B/B5�3B5Fc���URRS5 SRUR5nURSS2	URU5 Ub�[	US5(aURU5nO[
U5 U4nUHsnU(dURS:�a[S5 M'U(a4URS:Xa$[U5S	S
3RS5U-S-nURU5 Mu U(a#URS:XaURS5 gggg![a4 [U5nN�![a [S[U5-5ef=ff=f)
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.
)r6r6rQNr�zAmessage_body should be a bytes-like object or an iterable, got %rrzZero length chunk ignoredr��Xr^rCs0

)r+�extendr\rbr�r�r�r!�iterr�rlr��	_http_vsnr>r)rB�message_body�encode_chunkedrn�chunks�chunks      r)�_send_output�HTTPConnection._send_output:s^��	
�����J�'��l�l�4�<�<�(���L�L��O��	�	�#���#��|�V�,�,��,�,�\�:��-�
�|�,�+�_�F��������*��9�:��!�d�n�n��&:�"�5�z�!�n�D�1�8�8��A�E�I�!�"�E��	�	�%� � ��$�.�.�B�"6��	�	�,�'�#7�~�O$��!�>�>�!%�l�!3���$�>�'�)H�*.�|�*<�)=�>�>�>��>�s�>D1�1
E/�<E	�	"E+�+E/c���UR(a&URR5(aSUlUR[:Xa[UlO[UR5eUR
U5 XlU=(d SnURU5 U<SU<SUR<3nURURU55 URS:XGaBU(GdSnURS5(a[U5upv  nU(a.URS5nUR#S	[%U55 O�UR&(aUR&n	UR(n
OUR*n	UR,n
U	RS5nUR/U5nS
U	;a[%U5nX�R0:XaUR#S	U5 O*UR3S5nUR#S	U<S
U
<35 U(dUR#SS5 ggg![ a URS5nGNf=f![ a U	RS5nN�f=f)
a0Send 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�/r`r�r~rdrCrBrDr;zAccept-Encoding�identity)r,r�r.r-�_CS_REQ_STARTEDr�_validate_methodrm�_validate_pathrar��_encode_requestr�r2rrr �	putheaderr5r/r0r4r5r[rPr])rBrxry�	skip_host�skip_accept_encoding�request�netloc�nil�
netloc_encr4r5�host_encs            r)�
putrequest�HTTPConnection.putrequestps����?�?�t���7�7�9�9�"�D�O�*�<�<�8�#�*�D�L�#�D�L�L�1�1����f�%����j�S�����C� � &��T�-?�-?�@�����T�)�)�'�2�3��>�>�R������>�>�&�)�)�19�#��.�C��c�3��;�%+�]�]�7�%;�
��N�N�6�+<�Z�+H�I��(�(�#�0�0��#�0�0��#�y�y��#�y�y��7�#'�;�;�w�#7�� $���x�8�H��d�{�#4�X�#>���0�0�0����v�x�8�#+�?�?�7�#;�����v�(�D�/I�J�(����0�*�=�(�
��c.�;�%+�]�]�6�%:�
�;��.�7�#'�;�;�v�#6��7�s$� H+�I
�+I
�	I
�
I+�*I+c�$�URS5$)NrC)r)rBr�s  r)r��HTTPConnection._encode_request�s���~�~�g�&�&r6c��[RU5nU(a"[SU<SUR5<S35eg)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)rBrx�matchs   r)r��HTTPConnection._validate_method�sI��5�;�;�F�C����?��z�J'�',�{�{�}�&7�q�:�;�
;�r6c��[RU5nU(a"[SU<SUR5<S35eg)zValidate a url for putrequest.�&URL can't contain control characters. r�r�N��!_contains_disallowed_url_pchar_rer�rr�)rBryr�s   r)r��HTTPConnection._validate_path�sL��2�8�8��=����E�c�W�M0�05���
�/@��C�D�
D�r6c��[RU5nU(a"[SU<SUR5<S35eg)z9Validate a host so it doesn't contain control characters.r�r�r�Nr�)rBr4r�s   r)r6�HTTPConnection._validate_hostsL��2�8�8��>����E�d�X�N0�05���
�/@��C�D�
D�r6c�F�UR[:wa
[5e[US5(aUR	S5n[U5(d[
SU<35e[U5n[U5H~up4[US5(aUR	S5X#'O1[U[5(a[U5R	S5X#'[X#5(dMo[
SX#<35e SRU5nUS-U-nURU5 g)	z[Send a request header line to the server.

For example: h.putheader('Accept', 'text/html')
rrCzInvalid header name rzInvalid header value s
	s: N)r.r�rr�r�_is_legal_header_namer�r��	enumerater�r�r�_is_illegal_header_valuer\r�)rBr?�valuesr��	one_valuer�s      r)r��HTTPConnection.putheaders���
�<�<�?�*�"�$�$��6�8�$�$��]�]�7�+�F�$�V�,�,���A�B�B��f���%�f�-�L�A��y�(�+�+�%�,�,�Y�7��	��I�s�+�+��	�N�1�1�'�:��	�'��	�2�2� �f�i�!I�J�J�.����v�&���%��%�'�����V�r6�r�c�v�UR[:Xa[UlO
[5eUR	XS9 g)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.
r�N)r.r��_CS_REQ_SENTrr�)rBr�r�s   r)�
endheaders�HTTPConnection.endheaders(s1���<�<�?�*�'�D�L�"�$�$����,��Fr6c�*�URXX4U5 g)z&Send a complete request to the server.N)�
_send_request)rBrxryr"rWr�s      r)r��HTTPConnection.request5s��	
���6��~�Fr6c��[SU55n0nSU;aSUS'SU;aSUS'UR"X40UD6 SU;anSU;agS	nURX15nUc6Ub2URS
:�a[	SU-5 SnURS
S5 OURS[
U55 OS	nUR5Hup�URX�5 M [U[5(a[US5nURX5S9 g)Nc3�@# �UHoR5v� M g7fr�r=)r>�ks  r)r@�/HTTPConnection._send_request.<locals>.<genexpr><s��� <�G�q�����G�s�r4r<r�zaccept-encodingr�r�r�FrzUnable to determine size of %rTzTransfer-EncodingrszContent-Lengthr"r�)�	frozensetr�r$rlr�r�rr�r�r*r�)rBrxryr"rWr��header_names�skips�content_lengthr�r�s           r)r��HTTPConnection._send_request:s�� � <�G� <�<�����\�!�!"�E�+����,�,-�E�(�)�����-�u�-��<�/�#�,�6�"'��!%�!9�!9�$�!G��!�)��'��?�?�Q�.�!�"B�T�"I�J�)-�����':�I�F���N�N�#3�S��5H�I��"�N�!�-�-�/�J�C��N�N�3�&�*��d�C� � ��4��(�D������<r6c���UR(a&URR5(aSUlUR[:wdUR(a[	UR5eUR
S:�a0UR
URUR
URS9nO$UR
URURS9nUR5 UR[:wde[UlUR(aUR5 U$XlU$![a UR5 ef=f! UR5 e=f)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.r�rrlrcrwrmr��ConnectionErrorr�rvror-)rBris  r)�getresponse�HTTPConnection.getresponsehs!���?�?�t���7�7�9�9�"�D�O�"�<�<�<�'�4�?�?�"�4�<�<�0�0��?�?�Q���*�*�4�9�9�d�o�o�26�,�,�+�@�H��*�*�4�9�9�T�\�\�*�J�H�	�
���� ��&�&�(�2�2�2�#�D�L��"�"��
�
��
�O�#+���O��#�
��
�
���
��	��N�N���s%�D4�(AE�,E�4E�E�E&)�
__response�__stater+r9rmr2r1r/r0r*rlr4r5rwr)r()NN)NF)FFr�))rJrKrLrMr�rarrc�	HTTP_PORTrPrrl�staticmethodrr$r7�_GLOBAL_DEFAULT_TIMEOUTrzrJr3rUr[rkrnrhr�rbr�r�r�r�r�r�r�r6r�r�r�r�r�rNrIr6r)rr1s����I��M�!�N��L��I��J��1��1�
����>#'��0N�0N� $��;�."1�H�( ��
�@
�
�!�#G�J�	�4(�l16�(-�}�~'�;�D�D��8G�e�G�)-�b�G�$�G�
,=�\=r6rc�b^�\rSrSrSr\rS	\RSSSS.U4Sjjjr	U4Sjr
SrU=r$)
�HTTPSConnectioni�z(This class allows communication via SSL.Nr&)r(r)rr*c�j>�[[U]XUUUS9 Uc[UR5nXPlg)N)r*)r�r�rzrr��_context)rBr4r5r(r)rr*r�s       �r)rz�HTTPSConnection.__init__�s>���
�/�4�1�$�g�2@�<E�
2�
G���/����?��#�Mr6c��>�[TU]5 UR(a
URnOURnURRURUS9Ulg)z(Connect to a host on a given (SSL) port.)�server_hostnameN)r�rhr/r4r��wrap_socketrw)rBr�r�s  �r)rh�HTTPSConnection.connect�sQ���
�G�O��� � �"&�"3�"3��"&�)�)���
�
�1�1�$�)�)�BQ�2�S�D�Ir6)r�rwr�)
rJrKrLrM�__doc__�
HTTPS_PORTrPr7r�rzrhrNrr
s@r)r�r��s6���2�!��	$� &� >� >�$(�$�$�	$�	$�	S�	Sr6r�c��\rSrSrSrg)ri�rIN�rJrKrLrMrNrIr6r)rr�s��	r6rc��\rSrSrSrg)ri�rINr�rIr6r)rr����r6rc��\rSrSrSrg)ri�rINr�rIr6r)rr�r�r6rc��\rSrSrSrSrg)ri�c� �U4UlXlgr���argsrp)rBrps  r)rz�UnknownProtocol.__init__�s���H��	��r6r�N�rJrKrLrMrzrNrIr6r)rr�s��r6rc��\rSrSrSrg)r	i�rINr�rIr6r)r	r	�r�r6r	c��\rSrSrSrg)r
i�rINr�rIr6r)r
r
�r�r6r
c�<�\rSrSrSSjrSr\RrSrg)ri�Nc�,�U4UlXlX lgr�)r��partial�expected)rBr�r�s   r)rz�IncompleteRead.__init__�s���H��	��� �
r6c��URbSUR-nOSnSURR[UR5U4-$)Nz, %i more expectedr~z%s(%i bytes read%s))r�r�rJr>r�rxs  r)�__repr__�IncompleteRead.__repr__�sK���=�=�$�$�t�}�}�4�A��A�$����(?�(?�(+�D�L�L�(9�1�(>�>�	>r6)r�r�r�r�)	rJrKrLrMrzr�r"�__str__rNrIr6r)rr�s��!�>��n�n�Gr6rc��\rSrSrSrg)r
i�rINr�rIr6r)r
r
�r�r6r
c��\rSrSrSrg)ri�rINr�rIr6r)rr�r�r6rc��\rSrSrSrg)ri�rINr�rIr6r)rr�r�r6rc��\rSrSrSrg)ri�rINr�rIr6r)rr�r�r6rc��\rSrSrSrSrg)ri�c�D�U(d[U5nU4UlXlgr�)r�r�rFr�s  r)rz�BadStatusLine.__init__�s�����:�D��E��	��	r6)r�rFNr�rIr6r)rr�s��r6rc��\rSrSrSrSrg)ric�B�[RUS[U4-5 g)Nz&got more than %d bytes when reading %s)rrzrT)rB�	line_types  r)rz�LineTooLong.__init__s"�����t�%M�(0�)�'<�&=�	>r6rINr�rIr6r)rrs��>r6rc��\rSrSrSrSrg)ric�d�[RUS5 [R"U/UQ70UD6 g)Nr~)rrz�ConnectionResetError)rB�pos�kws   r)rz�RemoteDisconnected.__init__s*�����t�R�(��%�%�d�7�S�7�B�7r6rINr�rIr6r)rrs��8r6r)r&)Hr��email.parserr^�
email.messagervrdr�rer7rq�collections.abcr��urllib.parser�__all__r�r�ror-r�r��globals�updatere�__members__r��phraserrTrU�compile�	fullmatchr�r�r�r�r�rr*r�r5rj�Messager8rXrdrf�BufferedIOBaserrrrr�rA�ImportError�	Exceptionrrrrr	r
rr
rrrrrr
rr)�vs0r)�<module>rsm��D�L����	�	�
�
��!���
�	�
�
�����#�����	������,�,�-�#'�/�/�"=�"=�"D�"D�"F�G�"F�Q����[�"F�G�	�����6�
�
�#6�7�A�A���:�:�&C�D�K�K��%'�J�J�/@�$A�!�(*�z�z�-�'@�$�3��E����%���%�-�-�'�'��<�$.9�@�)�0�e�2�$�$�e�P
�t	�t	�l!&��S�.�S�8�N�N�$�%�	�I�	�
	�=�	�	��	��m��
	�m�	�	�M�	��]��	�m�	�	�/�	�	�.�	�	�.�	��M��>�-�>�
8�-�}�8�	���A-
H��z)�	��	�s�
H'�)H,�,H5�4H5

?>