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



Z@sdZddlZddlZddlZddlmZddlmZd
Zej	dd
dgZ
e
ddZe
ddZGdddeZ
dS)z"Http related parsers and protocol.N)AbstractStreamWriter)noopStreamWriterHttpVersion
HttpVersion10
HttpVersion11majorminorc@seZdZddZeddZeddZddZd	d
dZdd
Z	ddddddZ
ddddZdddZddZ
dS) rcCs^||_||_||_d|_d|_d|_d|_d|_d|_d|_	dS)NFr)
	_protocol
_transportlooplengthchunkedbuffer_sizeoutput_size_eof	_compressZ
_drain_waiter)selfprotocol	transportr
r/http_writer.py__init__s									zStreamWriter.__init__cCs|jS)N)r)rrrrr"szStreamWriter.transportcCs|jS)N)r)rrrrr&szStreamWriter.protocolcCs
d|_dS)NT)r)rrrrenable_chunking*szStreamWriter.enable_chunkingZdeflatecCs<|dkrdtjntj}tjd||_dS)NgzipZwbits)zlib	MAX_WBITScompressobjr)rencodingZ	zlib_moderrrenable_compression-s#zStreamWriter.enable_compressioncCskt|}|j|7_|j|7_|jdksH|jjrWtjd|jj|dS)Nz!Cannot write to closing transport)lenrrrZ
is_closingasyncioCancelledErrorwrite)rchunksizerrr_write2szStreamWriter._writedrainTLIMIT@icCs|jdk	r.|jj|}|s.tS|jdk	rt|}|j|krk|j||_n)|d|j}d|_|stS|r|jrdt|jd}||d}|j||j|kr|rd|_|j	StS)zWrites 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
)
rcompressrrr"rencoder(rr))rr&r)r*	chunk_lenrrrr%;s*		
	
zStreamWriter.writez: z
csS|djfdd|jD}|jdd}|j|dS)z*Write request/response status and headers.cs(g|]\}}||qSrr).0kv)ENDSEPrr
<listcomp>bs	z.StreamWriter.write_headers.<locals>.<listcomp>zutf-8s
N)joinitemsr.r()rZstatus_lineZheadersr5r4r)r4r5r
write_headers^s	&zStreamWriter.write_headerscs|jr
dS|jrz|r.|jj|}||jj}|r|jrdt|jd}||d}n?|jr|rdt|jd}||d}nd}|r|j||jIdHd|_d|_	dS)Nz%x
r,s
0

s0

T)
rrr-flushrr"r.r(r)r)rr&r/rrr	write_eoffs&			
	zStreamWriter.write_eofcs(|jjdk	r$|jjIdHdS)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__rpropertyrrrr!r(r%r9r<r)rrrrrs	#)rrrr)__doc__r#collectionsrabcrZhelpersr__all__
namedtuplerrrrrrrr<module>s
Back to Directory File Manager