Your IP : 216.73.216.213


Current Path : /opt/alt/python35/lib64/python3.5/site-packages/aiohttp/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/site-packages/aiohttp/__pycache__/http_writer.cpython-35.pyc



���Z��@s�dZddlZddlZddlZddlmZddlmZd
Zej	dd
dg�Z
e
dd�Ze
dd�ZGdd�de�Z
dS)z"Http related parsers and protocol.�N�)�AbstractStreamWriter)�noop�StreamWriter�HttpVersion�
HttpVersion10�
HttpVersion11�major�minorc@s�eZdZdd�Zedd��Zedd��Zdd�Zd	d
d�Zdd
�Z	dddddd�Z
dddd�Zddd�Zdd�Z
dS) rcCs^||_||_||_d|_d|_d|_d|_d|_d|_d|_	dS)NFr)
�	_protocol�
_transport�loop�length�chunked�buffer_size�output_size�_eof�	_compressZ
_drain_waiter)�self�protocol�	transportr
�r�F/opt/alt/python35/lib64/python3.5/site-packages/aiohttp/http_writer.py�__init__s									zStreamWriter.__init__cCs|jS)N)r)rrrrr"szStreamWriter.transportcCs|jS)N)r)rrrrr&szStreamWriter.protocolcCs
d|_dS)NT)r)rrrr�enable_chunking*szStreamWriter.enable_chunking�deflatecCs<|dkrdtjntj}tjd|�|_dS)N�gzip��wbits)�zlib�	MAX_WBITS�compressobjr)r�encoding�	zlib_moderrr�enable_compression-s#zStreamWriter.enable_compressioncCskt|�}|j|7_|j|7_|jdksH|jj�rWtjd��|jj|�dS)Nz!Cannot write to closing transport)�lenrrrZ
is_closing�asyncioZCancelledError�write)r�chunk�sizerrr�_write2szStreamWriter._write�drainT�LIMIT�@icCs|jdk	r.|jj|�}|s.t�S|jdk	r�t|�}|j|krk|j||_n)|d|j�}d|_|s�t�S|r�|jr�dt|�jd�}||d}|j|�|j|kr�|r�d|_|j	�St�S)z�Writes chunk of data to a stream.

        write_eof() indicates end of stream.
        writer can't be used after write_eof() method being called.
        write() return drain future.
        Nrz%x
�asciis
)
r�compressrrr%r�encoder*rr+)rr(r+r,�	chunk_lenrrrr';s*		
	
zStreamWriter.writez: z
csS|dj��fdd�|j�D��}|jd�d}|j|�dS)z*Write request/response status and headers.�cs(g|]\}}|�|��qSrr)�.0�k�v)�END�SEPrr�
<listcomp>bs	z.StreamWriter.write_headers.<locals>.<listcomp>zutf-8s
N)�join�itemsr0r*)rZstatus_line�headersr7r6r)r6r7r�
write_headers^s	&zStreamWriter.write_headers�c�s�|jr
dS|jrz|r.|jj|�}||jj�}|r�|jr�dt|�jd�}||d}n?|jr�|r�dt|�jd�}||d}nd}|r�|j|�|j�IdHd|_d|_	dS)Nz%x
r.s
0

s0

T)
rrr/�flushrr%r0r*r+r)rr(r1rrr�	write_eoffs&			
	zStreamWriter.write_eofc�s(|jjdk	r$|jj�IdHdS)zFlush the write buffer.

        The intended use is to write

          await w.write(data)
          await w.drain()
        N)rrZ
_drain_helper)rrrrr+�szStreamWriter.drainNi)�__name__�
__module__�__qualname__r�propertyrrrr$r*r'r<r?r+rrrrrs	#)rrrr)�__doc__r&�collectionsr�abcr�helpersr�__all__�
namedtuplerrrrrrrr�<module>s