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



Z@sddlZddlZddlmZddlmZmZmZddlm	Z	ddl
mZmZGdddeej
j
ZdS)	N)suppress)
ClientOSErrorClientPayloadErrorServerDisconnectedError)HttpResponseParser)
EMPTY_PAYLOAD	DataQueuec
seZdZdZddddZeddZedd	Zd
dZdd
Z	ddZ
fddZddZddZ
ddZfddZddZddddddd d!d"d#Zd$d%ZS)&ResponseHandlerz8Helper class to adapt between Protocol and StreamReader.loopNcCstjjj|d|tj|d|d|_d|_d|_d|_d|_	d|_
d|_d|_d|_
d|_d|_dS)NrF)asynciostreamsFlowControlMixin__init__r		transport
_should_close_message_payload
_skip_payload_payload_parser_reading_pausedZ_timer_tail	_upgraded_parser)selfrr/client_proto.pyrs										zResponseHandler.__init__cCs|jS)N)r)rrrrupgraded!szResponseHandler.upgradedcCsr|jdk	r|jjs(|jr,dS|jpq|jpq|jdk	pq|jdk	pqt|pq|jS)NT)ris_eofrr	exceptionrlenr)rrrrshould_close%szResponseHandler.should_closecCs5|j}|dk	r1|jd|_d|_|S)N)rcloser)rrrrrr#0s	
		zResponseHandler.closecCs
|jdk	S)N)r)rrrris_connected8szResponseHandler.is_connectedcCs
||_dS)N)r)rrrrrconnection_made;szResponseHandler.connection_madecs%|jdk	r0tt|jjWdQRXy|jj}Wn=tk
rd}|jdk	r~|jjtdYnX|jst	|t
rt|j}|dkrt
|}|j|d|_d|_d|_d|_d|_d|_d|_tj|dS)Nz!Response payload is not completedTF)rr	ExceptionZfeed_eofrr
set_exceptionrr
isinstanceOSErrorrargsrrrrrsuperconnection_lost)rexcZuncompleted)	__class__rrr,>s0

	
							zResponseHandler.connection_lostcCsdS)Nr)rrrreof_received^szResponseHandler.eof_receivedc
CsE|jsAy|jjWntttfk
r7YnXd|_dS)NT)rr
pause_readingAttributeErrorNotImplementedErrorRuntimeError)rrrrr0as	zResponseHandler.pause_readingc
CsE|jrAy|jjWntttfk
r7YnXd|_dS)NF)rrresume_readingr1r2r3)rrrrr4is	zResponseHandler.resume_readingcsd|_tj|dS)NT)rr+r')rr-)r.rrr'qs	zResponseHandler.set_exceptioncCs?||_||_|jr;|jd}|_|j|dS)Nr)rrr
data_received)rparserpayloaddatarrr
set_parserus
			zResponseHandler.set_parsertimerskip_payloadFread_until_eofauto_decompressTcCsc||_t||jd|dtd|d||_|jr_|jd}|_|j|dS)Nr:Zpayload_exceptionr<r=r)rrZ_looprrrr5)rr:r;r<r=r8rrrset_response_params}s		z#ResponseHandler.set_response_paramsc	Cs|s
dS|jdk	r`|jj|\}}|r\d|_d|_|r\|j|dS|jsx|jdkr|j|7_ny|jj|\}}}WnCtk
r}z#|jj	|j
|dSWYdd}~XnX||_x|D]w\}}|jrd|_||_
||_|jsG|jdkr`|j|tfdq|j||fdqW|r|r|j|n	||_dS)NT0r)r?r@)rZ	feed_datarr5rrr
BaseExceptionrr#r'r"rrrcoder)	rr8eoftailZmessagesrr-messager7rrrr5s>		


					zResponseHandler.data_received)__name__
__module____qualname____doc__rpropertyrr"r#r$r%r,r/r0r4r'r9r>r5rr)r.rr
s$ 	r
)r
Zasyncio.streams
contextlibrZclient_exceptionsrrrZhttprrrr	rr
rrrr<module>s
Back to Directory File Manager