PNG  IHDR;IDATxܻn0K )(pA 7LeG{ §㻢|ذaÆ 6lذaÆ 6lذaÆ 6lom$^yذag5bÆ 6lذaÆ 6lذa{ 6lذaÆ `}HFkm,mӪôô! x|'ܢ˟;E:9&ᶒ}{v]n&6 h_tڠ͵-ҫZ;Z$.Pkž)!o>}leQfJTu іچ\X=8Rن4`Vwl>nG^is"ms$ui?wbs[m6K4O.4%/bC%t Mז -lG6mrz2s%9s@-k9=)kB5\+͂Zsٲ Rn~GRC wIcIn7jJhۛNCS|j08yiHKֶۛkɈ+;SzL/F*\Ԕ#"5m2[S=gnaPeғL lذaÆ 6l^ḵaÆ 6lذaÆ 6lذa; _ذaÆ 6lذaÆ 6lذaÆ RIENDB`  oY]e @sddlZddlZyddlZWnek rBdZYnXddlmZddlmZddlmZddlmZddl m Z dd Z d d Z d Z d ZdZdZGdddeZGdddejejZGdddejZdS)N) base_events)compat) protocols) transports)loggercCs|rtdttdr?tj}|sd|_nLtjtj}|jtjO_|jtj O_|j tj |_ |S)Nz(Server side SSL needs a valid SSLContextcreate_default_contextF) ValueErrorhasattrsslrcheck_hostnameZ SSLContextZPROTOCOL_SSLv23optionsZ OP_NO_SSLv2Z OP_NO_SSLv3Zset_default_verify_pathsZ CERT_REQUIRED verify_mode) server_sideserver_hostname sslcontextr'/opt/python35/lib/python3.5/sslproto.py_create_transport_contexts     rcCs ttdS)N MemoryBIO)r r rrrr_is_sslproto_available%srZ UNWRAPPEDZ DO_HANDSHAKEZWRAPPEDZSHUTDOWNc@seZdZdZdddZeddZedd Zed d Zed d Z dddZ dddZ ddZ dddZ dddZdS)_SSLPipeiNcCsj||_||_||_t|_tj|_tj|_d|_ d|_ d|_ d|_ dS)NF) _context _server_side_server_hostname _UNWRAPPED_stater r _incoming _outgoing_sslobj _need_ssldata _handshake_cb _shutdown_cb)selfcontextrrrrr__init__Ds       z_SSLPipe.__init__cCs|jS)N)r)r$rrrr%Zsz_SSLPipe.contextcCs|jS)N)r )r$rrr ssl_object_sz_SSLPipe.ssl_objectcCs|jS)N)r!)r$rrr need_ssldatagsz_SSLPipe.need_ssldatacCs |jtkS)N)r_WRAPPED)r$rrrwrappedmsz_SSLPipe.wrappedcCs||jtkrtd|jj|j|jd|jd|j|_ t |_||_ |j ddd\}}|S)Nz"handshake in progress or completedrronly_handshakeT) rr RuntimeErrorrZwrap_biorrrrr _DO_HANDSHAKEr" feed_ssldata)r$callbackssldataappdatarrr do_handshakevs      z_SSLPipe.do_handshakecCsa|jtkrtd|jtkr6tdt|_||_|jd\}}|S)Nzno security layer presentzshutdown in progressr+)rrr- _SHUTDOWNr#r/)r$r0r1r2rrrshutdowns     z_SSLPipe.shutdowncCs&|jj|jd\}}dS)Nr+)rZ write_eofr/)r$r1r2rrrfeed_eofs z_SSLPipe.feed_eofFcCs|jtkr1|r!|g}ng}g|fSd|_|rP|jj|g}g}y|jtkr|jjt|_|j r|j d|r||fS|jtkrx|jj |j }|j ||sPqWni|jt kr0|jjd|_t|_|jrU|jn%|jtkrU|j |jj Wntjtjfk r}zlt|ddtjtjtjfkr|jtkr|j r|j ||jtjk|_WYdd}~XnX|jjr|j |jj ||fS)NFerrno)rrr!rwriter.r r3r)r"readmax_sizeappendr4Zunwrapr#r SSLErrorCertificateErrorgetattrSSL_ERROR_WANT_READSSL_ERROR_WANT_WRITESSL_ERROR_SYSCALLr7rpending)r$datar,r2r1chunkexcrrrr/sV                ( z_SSLPipe.feed_ssldatarcCsl|jtkrM|t|kr7||dg}ng}|t|fSg}t|}xd|_y6|t|kr||jj||d7}Wn|tjk r}zY|j dkrtj |_ |j tj tj tj fkr|j tj k|_WYdd}~XnX|jjrB|j|jj|t|ks]|jrbPqbW||fS)NFZPROTOCOL_IS_SHUTDOWN)rrlen memoryviewr!r r8r r<reasonr?r7r@rArrBr;r9)r$rCoffsetr1viewrErrr feed_appdatas2  $  ( z_SSLPipe.feed_appdatai)__name__ __module__ __qualname__r:r&propertyr%r'r(r*r3r5r6r/rKrrrrr0s   Jrc@seZdZddZdddZddZdd Zd d Zd d Ze j rlddZ ddZ ddZ ddddZddZddZddZddZdS)_SSLProtocolTransportcCs(||_||_||_d|_dS)NF)_loop _ssl_protocol _app_protocol_closed)r$loopZ ssl_protocol app_protocolrrrr&)s   z_SSLProtocolTransport.__init__NcCs|jj||S)N)rR_get_extra_info)r$namedefaultrrrget_extra_info0sz$_SSLProtocolTransport.get_extra_infocCs ||_dS)N)rS)r$protocolrrr set_protocol4sz"_SSLProtocolTransport.set_protocolcCs|jS)N)rS)r$rrr get_protocol7sz"_SSLProtocolTransport.get_protocolcCs|jS)N)rT)r$rrr is_closing:sz _SSLProtocolTransport.is_closingcCsd|_|jjdS)NT)rTrR_start_shutdown)r$rrrclose=s z_SSLProtocolTransport.closecCs+|js'tjd|t|jdS)Nzunclosed transport %r)rTwarningswarnResourceWarningr`)r$rrr__del__Ls z_SSLProtocolTransport.__del__cCs|jjjdS)N)rR _transport pause_reading)r$rrrrfQsz#_SSLProtocolTransport.pause_readingcCs|jjjdS)N)rRreresume_reading)r$rrrrgYsz$_SSLProtocolTransport.resume_readingcCs|jjj||dS)N)rRreset_write_buffer_limits)r$highlowrrrrhasz-_SSLProtocolTransport.set_write_buffer_limitscCs|jjjS)N)rRreget_write_buffer_size)r$rrrrkvsz+_SSLProtocolTransport.get_write_buffer_sizecCsTt|tttfs6tdjt|j|s@dS|jj |dS)Nz/data: expecting a bytes-like instance, got {!r}) isinstancebytes bytearrayrG TypeErrorformattyperLrR_write_appdata)r$rCrrrr8zs  z_SSLProtocolTransport.writecCsdS)NFr)r$rrr can_write_eofsz#_SSLProtocolTransport.can_write_eofcCs|jjdS)N)rR_abort)r$rrrabortsz_SSLProtocolTransport.abort)rLrMrNr&rZr\r]r^r`rZPY34rdrfrgrhrkr8rsrurrrrrP&s            rPc@seZdZdddddZdddZdd Zd d Zd d ZddZddZ ddZ dddZ ddZ ddZ ddZddZddZd d!d"Zd#d$Zd%d&ZdS)' SSLProtocolFNTcCstdkrtd|s-t||}||_|rO| rO||_n d|_||_td||_tj |_ d|_ ||_ ||_ ||_t|j ||j|_d|_d|_d|_d|_d|_||_dS)Nzstdlib ssl module not availablerrF)r r-rrr _sslcontextdict_extra collectionsdeque_write_backlog_write_buffer_size_waiterrQrSrP_app_transport_sslpipe_session_established _in_handshake _in_shutdownre_call_connection_made)r$rUrVrwaiterrrZcall_connection_maderrrr&s.                 zSSLProtocol.__init__cCs^|jdkrdS|jjsQ|dk rA|jj|n|jjdd|_dS)N)r~ cancelled set_exception set_result)r$rErrr_wakeup_waiters zSSLProtocol._wakeup_waitercCs5||_t|j|j|j|_|jdS)N)rerrwrrr_start_handshake)r$ transportrrrconnection_mades   zSSLProtocol.connection_madecCsN|jr+d|_|jj|jj|d|_d|_|j|dS)NF)rrQ call_soonrSconnection_lostrerr)r$rErrrrs     zSSLProtocol.connection_lostcCs|jjdS)N)rS pause_writing)r$rrrrszSSLProtocol.pause_writingcCs|jjdS)N)rSresume_writing)r$rrrrszSSLProtocol.resume_writingcCsy|jj|\}}Wnatjk r}z>|jjr_tjd||j|j |j dSWYdd}~XnXx|D]}|j j |qWx2|D]*}|r|j j|q|jPqWdS)Nz%r: SSL error %s (reason %s))rr/r r<rQ get_debugrwarningr7rHrtrer8rS data_receivedr_)r$rCr1r2erDrrrrs     zSSLProtocol.data_receivedc Cspz[|jjr"tjd||jt|jsZ|jj}|rZtj dWd|j j XdS)Nz%r received EOFz?returning true from eof_received() has no effect when using ssl) rQrrdebugrConnectionResetErrorrrS eof_receivedrrer`)r$Z keep_openrrrrs  zSSLProtocol.eof_receivedcCsD||jkr|j|S|jdk r<|jj||S|SdS)N)ryrerZ)r$rXrYrrrrWs  zSSLProtocol._get_extra_infocCs=|jr dS|jr#|jnd|_|jddS)NTr+)rrrtrr)r$rrrr_&s     zSSLProtocol._start_shutdowncCs9|jj|df|jt|7_|jdS)Nr)r|r;r}rF_process_write_backlog)r$rCrrrrr/szSSLProtocol._write_appdatacCsm|jjr4tjd||jj|_n d|_d|_|jjd|jj |j dS)Nz%r starts SSL handshakeTr+r)r+r) rQrrrtime_handshake_start_timerr|r;rr)r$rrrr4s  zSSLProtocol._start_handshakecCsd|_|jj}ye|dk r*||j}t|jdsy|jry|jjtj krytj ||jWnt k r!}z|j j rt|tjrtjd|ddntjd|dd|jjt|tr |j|dSWYdd}~XnX|j j r^|j j|j}tjd||d|jjd |d |jd |jd ||jr|jj|j |jd|_!|j j"|j#dS) NFr z5%r: SSL handshake failed on verifying the certificateexc_infoTz%r: SSL handshake failedz%r: SSL handshake took %.1f msg@@peercertcipher compressionr')$rrr'Z getpeercertr rwrrr Z CERT_NONEZmatch_hostname BaseExceptionrQrrlr=rrrer` ExceptionrrrrryupdaterrrrSrrrrr)r$Z handshake_excZsslobjrrEZdtrrr_on_handshake_complete@sD               z"SSLProtocol._on_handshake_completecCs|jdkrdSyxtt|jD]}|jd\}}|ri|jj||\}}n?|r|jj|j}d}n|jj|j }d}x|D]}|jj |qW|t|kr||f|jd<|jj r|jj P|jd=|j t|8_ q,WWn`tk r}z@|jrZ|j|n|j|dt|ts|WYdd}~XnXdS)NrrzFatal error on SSL transport)rerangerFr|rrKr3rr5 _finalizer8Z_pausedrgr}rr _fatal_errorrlr)r$irCrIr1rDrErrrrts8        z"SSLProtocol._process_write_backlogzFatal error on transportc Cst|tjr=|jjrhtjd||ddn+|jjd|d|d|jd|i|jr|jj |dS)Nz%r: %srTmessage exceptionrr[) rlrZ_FATAL_ERROR_IGNORErQrrrZcall_exception_handlerreZ _force_close)r$rErrrrrs    zSSLProtocol._fatal_errorcCs)d|_|jdk r%|jjdS)N)rrer`)r$rrrrs zSSLProtocol._finalizec Cs2z |jdk r|jjWd|jXdS)N)rerur)r$rrrrtszSSLProtocol._abort)rLrMrNr&rrrrrrrrWr_rrrrrrrrtrrrrrvs$ #       4 , rv)rzrar ImportErrorrrrrlogrrrrr.r)r4objectrZ_FlowControlMixinZ TransportrPZProtocolrvrrrrs(       n