403Webshell
Server IP : 127.0.0.1  /  Your IP : 216.73.216.109
Web Server : Apache/2.4.54 (Win64) OpenSSL/1.1.1q PHP/8.1.10
System : Windows NT DESKTOP-E5T4RUN 10.0 build 19045 (Windows 10) AMD64
User : SERVERWEB ( 0)
PHP Version : 8.1.10
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : OFF |  Perl : OFF |  Python : OFF |  Sudo : OFF |  Pkexec : OFF
Directory :  C:/cygwin64/lib/python3.6/site-packages/pip/_vendor/urllib3/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : C:/cygwin64/lib/python3.6/site-packages/pip/_vendor/urllib3/__pycache__/response.cpython-36.pyc
3

�N�a+n�@sXddlmZddlZddlZddlZddlmZddlmZ	ddlm
ZyddlZWne
k
rldZYnXddlmZddlmZmZdd	lmZmZmZmZmZmZmZmZmZmZdd
lmZddl m!Z!m"Z"ej#e$�Z%Gdd
�d
e&�Z'Gdd�de&�Z(Gdd�de&�Z)edk	�r*Gdd�de&�Z*Gdd�de&�Z+dd�Z,Gdd�dej-�Z.dS)�)�absolute_importN)�contextmanager)�error)�timeout�)�HTTPHeaderDict)�BaseSSLError�
HTTPException)
�BodyNotHttplibCompatible�DecodeError�	HTTPError�IncompleteRead�InvalidChunkLength�
InvalidHeader�
ProtocolError�ReadTimeoutError�ResponseNotChunked�SSLError)�six)�is_fp_closed�is_response_to_headc@s$eZdZdd�Zdd�Zdd�ZdS)�DeflateDecodercCsd|_d|_tj�|_dS)NT�)�
_first_try�_data�zlib�
decompressobj�_obj)�self�r�/usr/lib/python3.6/response.py�__init__$szDeflateDecoder.__init__cCst|j|�S)N)�getattrr)r�namerrr �__getattr__)szDeflateDecoder.__getattr__cCs�|s|S|js|jj|�S|j|7_y |jj|�}|rFd|_d|_|Stjk
r�d|_tjtj�|_z|j|j�Sd|_XYnXdS)NF)rr�
decompressrrrr�	MAX_WBITS)r�dataZdecompressedrrr r%,s"zDeflateDecoder.decompressN)�__name__�
__module__�__qualname__r!r$r%rrrr r#src@seZdZdZdZdZdS)�GzipDecoderStaterr�N)r(r)r*�FIRST_MEMBER�
OTHER_MEMBERS�SWALLOW_DATArrrr r+Csr+c@s$eZdZdd�Zdd�Zdd�ZdS)�GzipDecodercCstjdtj�|_tj|_dS)N�)rrr&rr+r-�_state)rrrr r!KszGzipDecoder.__init__cCst|j|�S)N)r"r)rr#rrr r$OszGzipDecoder.__getattr__cCs�t�}|jtjks|r t|�Sx�y||jj|�7}Wn8tjk
rn|j}tj|_|tj	krht|�S�YnX|jj
}|s�t|�Stj	|_tjdtj�|_q"WdS)Nr1)
�	bytearrayr2r+r/�bytesrr%rrr.Zunused_datarr&)rr'�retZprevious_staterrr r%Rs"
zGzipDecoder.decompressN)r(r)r*r!r$r%rrrr r0Jsr0c@seZdZdd�Zdd�ZdS)�
BrotliDecodercCs0tj�|_t|jd�r"|jj|_n
|jj|_dS)Nr%)�brotliZDecompressorr�hasattrr%Zprocess)rrrr r!ns
zBrotliDecoder.__init__cCst|jd�r|jj�SdS)N�flushr)r8rr9)rrrr r9us
zBrotliDecoder.flushN)r(r)r*r!r9rrrr r6jsr6c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�MultiDecodera
    From RFC7231:
        If one or more encodings have been applied to a representation, the
        sender that applied the encodings MUST generate a Content-Encoding
        header field that lists the content codings in the order in which
        they were applied.
    cCsdd�|jd�D�|_dS)NcSsg|]}t|j���qSr)�_get_decoder�strip)�.0�mrrr �
<listcomp>�sz)MultiDecoder.__init__.<locals>.<listcomp>�,)�split�	_decoders)rZmodesrrr r!�szMultiDecoder.__init__cCs|jdj�S)Nr)rBr9)rrrr r9�szMultiDecoder.flushcCs"xt|j�D]}|j|�}qW|S)N)�reversedrBr%)rr'�drrr r%�szMultiDecoder.decompressN)r(r)r*�__doc__r!r9r%rrrr r:{sr:cCs:d|krt|�S|dkrt�Stdk	r4|dkr4t�St�S)Nr@�gzip�br)r:r0r7r6r)�moderrr r;�sr;c@sleZdZdZddgZedk	r&edg7Zdddd	d
gZdOdd�Zdd�Zdd�Z	dd�Z
edd��Zedd��Z
dd�Zdd�Zdd �Zd!d"�ZeejfZedk	r�eejf7Zd#d$�Zd%d&�Zed'd(��ZdPd)d*�ZdRd-d.�Zed/d0��Zd1d2�ZdSd3d4�Zd5d6�Z d7d8�Z!ed9d:��Z"d;d<�Z#d=d>�Z$d?d@�Z%dAdB�Z&dCdD�Z'dEdF�Z(dGdH�Z)dTdIdJ�Z*dKdL�Z+dMdN�Z,dS)U�HTTPResponsea�
    HTTP Response container.

    Backwards-compatible with :class:`http.client.HTTPResponse` but the response ``body`` is
    loaded and decoded on-demand when the ``data`` property is accessed.  This
    class is also compatible with the Python standard library's :mod:`io`
    module, and can hence be treated as a readable object in the context of that
    framework.

    Extra parameters for behaviour not present in :class:`http.client.HTTPResponse`:

    :param preload_content:
        If True, the response's body will be preloaded during construction.

    :param decode_content:
        If True, will attempt to decode the body based on the
        'content-encoding' header.

    :param original_response:
        When this HTTPResponse wrapper is generated from an :class:`http.client.HTTPResponse`
        object, it's convenient to include the original for debug purposes. It's
        otherwise unused.

    :param retries:
        The retries contains the last :class:`~urllib3.util.retry.Retry` that
        was used during the request.

    :param enforce_content_length:
        Enforce content length checking. Body returned by server must match
        value of Content-Length header, if present. Otherwise, raise error.
    rFZdeflateNrGi-i.i/i3i4�rTFcCst|t�r||_n
t|�|_||_||_||_||_||_|
|_||_	||_
d|_d|_d|_
|	|_d|_||_||_|r�t|tjtf�r�||_|
|_||_t|d�r�||_
d|_d|_|jjdd�j�}dd�|jd�D�}d	|kr�d
|_|j|�|_|�r|j�r|j|d�|_dS)Nr�readFztransfer-encodingrJcss|]}|j�VqdS)N)r<)r=�encrrr �	<genexpr>�sz(HTTPResponse.__init__.<locals>.<genexpr>r@�chunkedT)�decode_content) �
isinstancer�headers�status�version�reason�strictrO�retries�enforce_content_length�
auto_close�_decoder�_body�_fp�_original_response�_fp_bytes_read�msg�_request_urlrZstring_typesr4�_pool�_connectionr8rN�
chunk_left�get�lowerrA�_init_length�length_remainingrK)r�bodyrQrRrSrTrUZpreload_contentrO�original_responseZpool�
connectionr^rVrW�request_methodZrequest_urlrXZtr_enc�	encodingsrrr r!�sB


zHTTPResponse.__init__cCs|j|jkr|jjd�SdS)a
        Should we redirect and where to?

        :returns: Truthy redirect location string if we got a redirect status
            code and valid location. ``None`` if redirect status and no
            location. ``False`` if not a redirect status code.
        �locationF)rR�REDIRECT_STATUSESrQrc)rrrr �get_redirect_locationsz"HTTPResponse.get_redirect_locationcCs,|js|jrdS|jj|j�d|_dS)N)r`raZ	_put_conn)rrrr �release_connszHTTPResponse.release_conncCs.y|j�Wnttttfk
r(YnXdS)z�
        Read and discard any remaining HTTP response data in the response connection.

        Unread data in the HTTPResponse connection blocks the connection from being released back to the pool.
        N)rKr�SocketErrorrr	)rrrr �
drain_connszHTTPResponse.drain_conncCs"|jr|jS|jr|jdd�SdS)NT)�
cache_content)rZr[rK)rrrr r'%szHTTPResponse.datacCs|jS)N)ra)rrrr ri.szHTTPResponse.connectioncCs
t|j�S)N)rr[)rrrr �isclosed2szHTTPResponse.isclosedcCs|jS)z�
        Obtain the number of bytes pulled over the wire so far. May differ from
        the amount of content returned by :meth:``urllib3.response.HTTPResponse.read``
        if bytes are encoded on the wire (e.g, compressed).
        )r])rrrr �tell5szHTTPResponse.tellcCs�|jjd�}|dk	r�|jr(tjd�dSy<tdd�|jd�D��}t|�dkrZtd|��|j	�}Wnt
k
r|d}YnX|d	kr�d}yt|j�}Wnt
k
r�d	}YnX|dks�d|ko�d
kns�|dkr�d	}|S)zM
        Set initial length value for Response content if available.
        zcontent-lengthNz�Received response with both Content-Length and Transfer-Encoding set. This is expressly forbidden by RFC 7230 sec 3.3.2. Ignoring Content-Length and attempting to process response as Transfer-Encoding: chunked.cSsg|]}t|��qSr)�int)r=�valrrr r?Wsz-HTTPResponse._init_length.<locals>.<listcomp>r@rz8Content-Length contained multiple unmatching values (%s)r���0�d��ZHEAD)rwrx)
rQrcrN�logZwarning�setrA�lenr�pop�
ValueErrorrurR)rrjZlengthZlengthsrRrrr re=s0

(zHTTPResponse._init_lengthcsh�jjdd�j�}�jdkrd|�jkr2t|��_n2d|krd�fdd�|jd�D�}t|�rdt|��_dS)z=
        Set-up the _decoder attribute if necessary.
        zcontent-encodingrJNr@cs"g|]}|j��jkr|j��qSr)r<�CONTENT_DECODERS)r=�e)rrr r?}sz.HTTPResponse._init_decoder.<locals>.<listcomp>)rQrcrdrYr�r;rAr})r�content_encodingrkr)rr �
_init_decoderqs


zHTTPResponse._init_decodercCsx|s|Sy|jr|jj|�}WnD|jk
rb}z&|jjdd�j�}td||��WYdd}~XnX|rt||j�7}|S)zN
        Decode the data passed in and potentially flush the decoder.
        zcontent-encodingrJzEReceived response with content-encoding: %s, but failed to decode it.N)rYr%�DECODER_ERROR_CLASSESrQrcrdr�_flush_decoder)rr'rO�
flush_decoderr�r�rrr �_decode�szHTTPResponse._decodecCs$|jr |jjd�}||jj�SdS)zk
        Flushes the decoder. Should only be called if the decoder is actually
        being used.
        r)rYr%r9)r�bufrrr r��szHTTPResponse._flush_decoderccs�d}z�y
dVWn�tk
r2t|jdd��Ynvtk
rt}z(dt|�krVt|��t|jdd��WYdd}~Xn4ttfk
r�}ztd||��WYdd}~XnXd}Wd|s�|j	r�|j	j
�|jr�|jj
�|j	r�|j	j�r�|j
�XdS)z�
        Catch low-level python exceptions, instead re-raising urllib3
        variants, so that low-level exceptions are not leaked in the
        high-level api.

        On exit, release the connection back to the pool.
        FNzRead timed out.zread operation timed outzConnection broken: %rT)�
SocketTimeoutrr`r�strrr	rprr\�closerarsro)rZ
clean_exitr�rrr �_error_catcher�s(	
 

zHTTPResponse._error_catchercCs|j�|dkr|j}|jdkr$dSd}t|jdd�}|j��x|dkr`|sV|jj�nd}d}nRd}|st|jj|�nd}|dkr�|r�|jj�d}|jr�|jdkr�t	|j
|j��WdQRX|�r
|j
t|�7_
|jdk	r�|jt|�8_|j|||�}|�r
||_
|S)aT
        Similar to :meth:`http.client.HTTPResponse.read`, but with two additional
        parameters: ``decode_content`` and ``cache_content``.

        :param amt:
            How much of the content to read. If specified, caching is skipped
            because it doesn't make sense to cache partial content as the full
            response.

        :param decode_content:
            If True, will attempt to decode the body based on the
            'content-encoding' header.

        :param cache_content:
            If True, will save the returned data such that the same result is
            returned despite of the state of the underlying file object. This
            is useful if you want the ``.data`` property to continue working
            after having ``.read()`` the file object. (Overridden if ``amt`` is
            set.)
        NF�closedrTr)rN)r�rOr[r"r�rKr�rWrfr
r]r}r�rZ)r�amtrOrrr�Z	fp_closedr'rrr rK�s8

	


zHTTPResponse.readr,r1ccsZ|jr.|j�r.xF|j||d�D]
}|VqWn(x&t|j�sT|j||d�}|r0|Vq0WdS)a_
        A generator wrapper for the read() method. A call will block until
        ``amt`` bytes have been read from the connection or until the
        connection is closed.

        :param amt:
            How much of the content to read. The generator will return up to
            much data per iteration, but may return less. This is particularly
            likely when using compressed data. However, the empty string will
            never be returned.

        :param decode_content:
            If True, will attempt to decode the body based on the
            'content-encoding' header.
        )rO)r�rON)rN�supports_chunked_reads�read_chunkedrr[rK)rr�rO�liner'rrr �stream+szHTTPResponse.streamc
Ksb|j}t|t�s.tjr"tj|�}nt|j��}t|dd�}|f|||j|j	|j
||d�|��}|S)a
        Given an :class:`http.client.HTTPResponse` instance ``r``, return a
        corresponding :class:`urllib3.response.HTTPResponse` object.

        Remaining parameters are passed to the HTTPResponse constructor, along
        with ``original_response=r``.
        rUr)rgrQrRrSrTrUrh)r^rPrrZPY2�from_httplib�itemsr"rRrSrT)ZResponseCls�rZresponse_kwrQrUZresprrr r�Es 	
zHTTPResponse.from_httplibcCs|jS)N)rQ)rrrr �
getheadersfszHTTPResponse.getheaderscCs|jj||�S)N)rQrc)rr#�defaultrrr �	getheaderiszHTTPResponse.getheadercCs|jS)N)rQ)rrrr �infomszHTTPResponse.infocCs6|js|jj�|jr |jj�|js2tjj|�dS)N)r�r[r�rarX�io�IOBase)rrrr r�qs

zHTTPResponse.closecCsT|jstjjj|�S|jdkr"dSt|jd�r8|jj�St|jd�rL|jjSdSdS)NTrsr�)rXr�r�r��__get__r[r8rs)rrrr r�{s

zHTTPResponse.closedcCs6|jdkrtd��nt|jd�r*|jj�Std��dS)Nz-HTTPResponse has no file to get a fileno from�filenozOThe file-like object this HTTPResponse is wrapped around has no file descriptor)r[�IOErrorr8r�)rrrr r��s


zHTTPResponse.filenocCs4|jdk	r0t|jd�r0t|jdd�r0|jj�SdS)Nr9r�F)r[r8r"r9)rrrr r9�s
zHTTPResponse.flushcCsdS)NTr)rrrr �readable�szHTTPResponse.readablecCs:|jt|��}t|�dkrdS||dt|��<t|�SdS)Nr)rKr})r�bZtemprrr �readinto�s
zHTTPResponse.readintocCst|jd�S)a
        Checks if the underlying file-like object looks like a
        :class:`http.client.HTTPResponse` object. We do this by testing for
        the fp attribute. If it is present we assume it returns raw chunks as
        processed by read_chunked().
        �fp)r8r[)rrrr r��sz#HTTPResponse.supports_chunked_readscCsf|jdk	rdS|jjj�}|jdd�d}yt|d�|_Wn&tk
r`|j�t||��YnXdS)N�;rrr1)	rbr[r��readlinerArurr�r)rr�rrr �_update_chunk_length�s
z!HTTPResponse._update_chunk_lengthcCs�d}|dkr2|jj|j�}|}|jjd�d|_nv||jkrZ|jj|�}|j||_|}nN||jkr�|jj|�}|jjd�d|_|}n |jj|j�}|jjd�d|_|S)Nr,)r[Z
_safe_readrb)rr�Zreturned_chunk�chunk�valuerrr �
_handle_chunk�s&

zHTTPResponse._handle_chunkccs�|j�|jstd��|j�s&td��|j���|jrNt|j�rN|jj�dS|j	j
dkr^dSx<|j�|jdkrtP|j
|�}|j||dd�}|r`|Vq`W|r�|j�}|r�|Vx |j	j
j�}|s�P|dkr�Pq�W|jr�|jj�WdQRXdS)a�
        Similar to :meth:`HTTPResponse.read`, but with an additional
        parameter: ``decode_content``.

        :param amt:
            How much of the content to read. If specified, caching is skipped
            because it doesn't make sense to cache partial content as the full
            response.

        :param decode_content:
            If True, will attempt to decode the body based on the
            'content-encoding' header.
        zHResponse is not chunked. Header 'transfer-encoding: chunked' is missing.zkBody should be http.client.HTTPResponse like. It should have have an fp attribute which returns raw chunks.NrF)rOr�s
)r�rNrr�r
r�r\rr�r[r�r�rbr�r�r�r�)rr�rOr�Zdecodedr�rrr r��sD




zHTTPResponse.read_chunkedcCs.|jdk	r$t|jj�r$|jjdjS|jSdS)z�
        Returns the URL that was the source of this response.
        If the request that generated this response redirected, this method
        will return the final redirect location.
        Nr���)rVr}�historyZredirect_locationr_)rrrr �geturlszHTTPResponse.geturlccs�g}x�|jdd�D]r}d|krz|jd�}dj|�|ddVx|dd�D]}|dVqNW|drt|d	g}q�g}q|j|�qW|r�dj|�VdS)
NT)rO�
rrrr�r�r�)r�rA�join�append)r�bufferr��xrrr �__iter__&s
zHTTPResponse.__iter__)rJNrrNrTTNNNNNFNNT)NNF�)r�N)N)NN)-r(r)r*rEr�r7rmr!rnrorq�propertyr'rirsrtrer�r�rrr�r�r�rr�rKr��classmethodr�r�r�r�r�r�r�r9r�r�r�r�r�r�r�r�rrrr rI�sn

1
	4
8
J
!


		
FrI)/Z
__future__rr�Zloggingr�
contextlibrZsocketrrprr�r7�ImportError�_collectionsrrirr	�
exceptionsr
rrr
rrrrrrZpackagesrZ
util.responserrZ	getLoggerr(r{�objectrr+r0r6r:r;r�rIrrrr �<module>s0
0
 


Youez - 2016 - github.com/yon3zu
LinuXploit