Files
aitsc/.venv/Lib/site-packages/engineio/__pycache__/base_server.cpython-312.pyc

84 lines
16 KiB
Plaintext
Raw Normal View History

2025-02-23 09:07:52 +08:00
<EFBFBD>
W0<57>gz8<00><00><><00>ddlZddlZddlZddlZddlZddlZddlZddlmZddlm Z ejd<05>Z Gd<06>d<07>Z y)<08>N<>)<01>packet)<01>payloadzengineio.serverc<00><><00>eZdZddgZgd<03>ZddgZdZdZGd<08>d <09>Z d d <0B>Z d <0C>Z
d <0A>Z d!d<0E>Z d<0F>Z d<10>Zd<11>Zd<12>Zd<13>Zd<14>Zd<15>Zd<16>Zd"d<17>Zd!d<18>Zd<19>Zd!d<1A>Zd<1B>Zd<1C>Zd<1D>Zd<1E>Zd<1F>Zy
)#<23>
BaseServer<EFBFBD>gzip<69>deflate)<03>connect<63>
disconnect<EFBFBD>message<67>polling<6E> websocketTrc<00>$<00>eZdZdZdZdZdZdZdZy)<08>BaseServer.reasonzDisconnection reasons.zserver disconnectzclient disconnectz ping timeoutztransport closeztransport errorN) <09>__name__<5F>
__module__<EFBFBD> __qualname__<5F>__doc__<5F>SERVER_DISCONNECT<43>CLIENT_DISCONNECT<43> PING_TIMEOUT<55>TRANSPORT_CLOSE<53>TRANSPORT_ERROR<4F><00><00>>D:\wxxcx\tsccc\.venv\Lib\site-packages\engineio/base_server.py<70>reasonrs <00><00>$<24>/<2F><19>/<2F><19>%<25> <0C>+<2B><0F>+<2B>rrNc <00><><00>||_t|t<00>r|d|_|d|_n||_d|_||_||_||_||_||_ | |_
|
|_ | |_ i|_ i|_t<00>|_|<0E>|n |j"|_d|_d|_| <0C>| t*j,_t| t0<00>s| |_n<>t4|_|j2j6t8j:k(r<>| r*|j2j=t8j><00>n)|j2j=t8j@<00>|j2jCt9jD<00><00>|jG<00>}|<01> ||vr|gng}d|_$d|_%|D]e} tMjNd|z<00>jH|_$d|jHvr|jHdnd}||jQ<00>k7r<01>^||_%n|jJ<00> tUd<06><00>|jQ<00>r(d|jHvs|jHds tUd<07><00>|jQ<00>s(d|jHvr|jHdr tUd<08><00>|<0F>=t|tV<00>r|g}|D<00>cgc]}||jXvr|<14><02>}}|s tUd <09><00>|xs |jX|_-|j2j]d
|jJ<00>y#tR$rY<00><01>vwxYwcc}w) Nrrzengineio.async_drivers.<2E>asyncioFzInvalid async_mode specifiedz1The selected async_mode is not asyncio compatiblezKThe selected async_mode requires asyncio and must use the AsyncServer classzNo valid transports providedzServer initialized for %s.)/<2F> ping_timeout<75>
isinstance<EFBFBD>tuple<6C> ping_interval<61>ping_interval_grace_period<6F>max_http_buffer_size<7A>allow_upgrades<65>http_compression<6F>compression_threshold<6C>cookie<69>cors_allowed_origins<6E>cors_credentials<6C>async_handlers<72>sockets<74>handlers<72>set<65>log_message_keys<79>_default_monitor_clients<74>start_service_task<73>service_task_handle<6C>service_task_eventr<00>Packet<65>json<6F>bool<6F>logger<65>default_logger<65>level<65>logging<6E>NOTSET<45>setLevel<65>INFO<46>ERROR<4F>
addHandler<EFBFBD> StreamHandler<65> async_modes<65>_async<6E>
async_mode<EFBFBD> importlib<69> import_module<6C>is_asyncio_based<65> ImportError<6F>
ValueError<EFBFBD>str<74>valid_transports<74>
transports<EFBFBD>info)<15>selfrDr#r r%r&r'r(r)r*r+r8r6r,<00>monitor_clientsrL<00>kwargs<67>modes<65>mode<64> asyncio_based<65> transports r<00>__init__zBaseServer.__init__#s
<00><00>)<29><04><19> <15>m<EFBFBD>U<EFBFBD> +<2B>!.<2E>q<EFBFBD>!1<>D<EFBFBD> <1E>.;<3B>A<EFBFBD>.><3E>D<EFBFBD> +<2B>!.<2E>D<EFBFBD> <1E>./<2F>D<EFBFBD> +<2B>$8<><04>!<21>,<2C><04><1B> 0<><04><1D>%:<3A><04>"<22><1C><04> <0B>$8<><04>!<21> 0<><04><1D>,<2C><04><1B><19><04> <0C><1A><04> <0A> #<23><05><04><1D><1E>*<2A>#2<>04<30>0M<30>0M<30> <0A><1F>#'<27><04> <20>"&<26><04><1F> <0F> <1B>!%<25>F<EFBFBD>M<EFBFBD>M<EFBFBD> <1E><19>&<26>$<24>'<27> <20>D<EFBFBD>K<EFBFBD>(<28>D<EFBFBD>K<EFBFBD><13>{<7B>{<7B> <20> <20>G<EFBFBD>N<EFBFBD>N<EFBFBD>2<><19><18>K<EFBFBD>K<EFBFBD>(<28>(<28><17><1C><1C>6<><18>K<EFBFBD>K<EFBFBD>(<28>(<28><17><1D><1D>7<><14> <0B> <0B>&<26>&<26>w<EFBFBD>'<<3C>'<<3C>'><3E>?<3F><14> <20> <20>"<22><05> <15> !<21>$.<2E>%<25>$7<>Z<EFBFBD>L<EFBFBD>R<EFBFBD>E<EFBFBD><1A><04> <0B><1E><04><0F><19>D<EFBFBD>
<15>'<27>5<>5<>-<2D><04>4<>6<>6<<3C>f<EFBFBD><15> <0B>!<21>D<EFBFBD>K<EFBFBD>K<EFBFBD>/<2F>!%<25> <0B> <0B>I<EFBFBD> 6<>5:<3A><1E> <20>D<EFBFBD>$9<>$9<>$;<3B>;<3B><1C>"&<26><04><0F><15><1A> <10>?<3F>?<3F> "<22><1C>;<3B><<3C> <<3C> <0F> <20> <20> "<22><1A>$<24>+<2B>+<2B>-<2D><15><1B><1B>Y<EFBFBD>'<27><1C>*<2A>+<2B> +<2B><13>$<24>$<24>&<26>9<EFBFBD><04> <0B> <0B>+C<><14> <0B> <0B>I<EFBFBD>&<26><1C>><3E>?<3F> ?<3F> <15> !<21><19>*<2A>c<EFBFBD>*<2A>(<28>\<5C>
<EFBFBD>5?<3F>A<01>Z<EFBFBD> <09>&<26>$<24>*?<3F>*?<3F>?<3F>$<24>Z<EFBFBD>J<EFBFBD>A<01><1D> <20>!?<3F>@<40>@<40>$<24>=<3D><04>(=<3D>(=<3D><04><0F> <0C> <0B> <0B><18><18>5<>t<EFBFBD><EFBFBD><EFBFBD>G<><47>+<1F> <15><14> <15><> As<00>AL+<02>L+<02> L;<04>+ L8<05>7L8c<00><00>y)NFr<00>rNs rrGzBaseServer.is_asyncio_basedrs<00><00>rc<00>
<00>gd<01>S)N)<04>eventlet<65> gevent_uwsgi<67>gevent<6E> threadingrrWs rrBzBaseServer.async_modesus<00><00>B<>Brc<00>^<00><00><01><00><01>jvr td<01><00><01><01>fd<02>}|<02>|S||<02>y)a<>Register an event handler.
:param event: The event name. Can be ``'connect'``, ``'message'`` or
``'disconnect'``.
:param handler: The function that should be invoked to handle the
event. When this parameter is not given, the method
acts as a decorator for the handler function.
Example usage::
# as a decorator:
@eio.on('connect')
def connect_handler(sid, environ):
print('Connection request')
if environ['REMOTE_ADDR'] in blacklisted:
return False # reject
# as a method:
def message_handler(sid, msg):
print('Received message: ', msg)
eio.send(sid, 'response')
eio.on('message', message_handler)
The handler function receives the ``sid`` (session ID) for the
client as first argument. The ``'connect'`` event handler receives the
WSGI environment as a second argument, and can return ``False`` to
reject the connection. The ``'message'`` handler receives the message
payload as a second argument. The ``'disconnect'`` handler does not
take a second argument.
z Invalid eventc<00>&<00><02>|<00>j<00><|S<00>N)r.)<03>handler<65>eventrNs <20><>r<00> set_handlerz"BaseServer.on.<locals>.set_handler<65>s<00><><00>#*<2A>D<EFBFBD>M<EFBFBD>M<EFBFBD>%<25> <20><1A>NrN)<02> event_namesrI)rNrar`rbs`` r<00>onz BaseServer.onxs8<00><><00>> <11><04>(<28>(<28> (<28><1C>_<EFBFBD>-<2D> -<2D> <1B> <13>?<3F><1E> <1E><13>G<EFBFBD>rc<00>@<00>|j|<01>jrdSdS)z<>Return the name of the transport used by the client.
The two possible values returned by this function are ``'polling'``
and ``'websocket'``.
:param sid: The session of the client.
rr )<02> _get_socket<65>upgraded)rN<00>sids rrTzBaseServer.transport<72>s"<00><00>#<23>.<2E>.<2E>s<EFBFBD>3<><<3C><<3C>{<7B>K<>)<29>Krc<00>,<00>|jd|i|<02><01>S)z<>Create a queue object using the appropriate async model.
This is a utility function that applications can use to create a queue
without having to worry about using the correct call for the selected
async mode.
<20>queue<75>rC<00>rN<00>argsrPs r<00> create_queuezBaseServer.create_queue<75><00><00><00>$<24>t<EFBFBD>{<7B>{<7B>7<EFBFBD>#<23>T<EFBFBD>4<>V<EFBFBD>4<>4rc<00> <00>|jdS)z<>Return the queue empty exception for the appropriate async model.
This is a utility function that applications can use to work with a
queue without having to worry about using the correct call for the
selected async mode.
<20> queue_emptyrkrWs r<00>get_queue_empty_exceptionz$BaseServer.get_queue_empty_exception<6F>s<00><00><14>{<7B>{<7B>=<3D>)<29>)rc<00>,<00>|jd|i|<02><01>S)z<>Create an event object using the appropriate async model.
This is a utility function that applications can use to create an
event without having to worry about using the correct call for the
selected async mode.
rarkrls r<00> create_eventzBaseServer.create_event<6E>rorc<00><00>tjtjd<01>|jj dd<03>z<00>}|jdzdz|_|j d<06>jdd<08>jd d
<EFBFBD>S) zGenerate a unique session id.<2E> <00><00>bigri<><69><EFBFBD><00>utf-8<>/<2F>_<>+<2B>-)<08>base64<36> b64encode<64>secrets<74> token_bytes<65>sequence_number<65>to_bytes<65>decode<64>replace)rN<00>ids r<00> generate_idzBaseServer.generate_id<69>sz<00><00> <13> <1D> <1D> <13> <1F> <1F><02> #<23>d<EFBFBD>&:<3A>&:<3A>&C<>&C<>A<EFBFBD>u<EFBFBD>&M<> M<>O<01><02> $<24> 4<> 4<>q<EFBFBD> 8<>H<EFBFBD>D<><04><1C><11>y<EFBFBD>y<EFBFBD><17>!<21>)<29>)<29>#<23>s<EFBFBD>3<>;<3B>;<3B>C<EFBFBD><13>E<>Erc<00><><00>|jdd<02>dz|z}|j<00>D]8\}}|dk(r<01> t|<05>r|<05>}|dur |d|zz }<03>+|d|zdz|zz }<03>:|S)zGenerate the sid cookie.<2E>name<6D>io<69>=Tz; )<03>get<65>items<6D>callable)rNrh<00>
attributesr)<00> attribute<74>values r<00>_generate_sid_cookiezBaseServer._generate_sid_cookie<69>s<><00><00><1B><1E><1E><06><04>-<2D><03>3<>c<EFBFBD>9<><06> *<2A> 0<> 0<> 2<> <1C>I<EFBFBD>u<EFBFBD><18>F<EFBFBD>"<22><18><17><05><EFBFBD><1D><07><05><14><04>}<7D><16>$<24><19>*<2A>*<2A><06><16>$<24><19>*<2A>S<EFBFBD>0<>5<EFBFBD>8<>8<><06>!3<><16> rc<00><><00>|jr |j|<01>js|dk(rgS|jd<00>|j dd<03>gSdgS)z=Return the list of possible upgrades for a client connection.rz<>The WebSocket transport is not available, you must install a WebSocket server that is compatible with your async mode to enable it. See the documentation for details.z no-websocket)r&rfrgrC<00>_log_error_once)rNrhrTs r<00> _upgradeszBaseServer._upgrades<65>sb<00><00><13>"<22>"<22>d<EFBFBD>&6<>&6<>s<EFBFBD>&;<3B>&D<>&D<><19>[<5B>(<28><15>I<EFBFBD> <0F>;<3B>;<3B>{<7B> #<23> +<2B> <10> <20> <20>@<01><1F>  <20>
<16>I<EFBFBD><1B>}<7D>rc<00><><00> |j|}|jr|j|=td<02><00>|S#t$r td<01><00>wxYw)z-Return the socket object for a given session.zSession not foundzSession is disconnected)r-<00>KeyError<6F>closed)rNrh<00>ss rrfzBaseServer._get_socket<65>sX<00><00> 0<><14> <0C> <0C>S<EFBFBD>!<21>A<EFBFBD> <0A>8<EFBFBD>8<EFBFBD><14> <0C> <0C>S<EFBFBD>!<21><1A>4<>5<> 5<><10><08><> <18> 0<><1A>.<2E>/<2F> /<2F> 0<>s <00>7<00>A c<00><><00>|<01>C|<02>g}|dgz }d|tj|<01><03>j|<03><04>jd<05>d<06>Sddgdd<06>S) z$Generate a successful HTTP response.)<02> Content-Typeztext/plain; charset=UTF-8z200 OK)<01>packets)<01> jsonp_indexry<00><03>status<75>headers<72>response<73>r<>z
text/plainsOK)r<00>Payload<61>encode)rNr<>r<>r<>s r<00>_okzBaseServer._ok<6F>ss<00><00> <12> <1E><16><EFBFBD><1C><07> <13>E<>F<> F<>G<EFBFBD>&<26>&<26> '<27><0F><0F><07> @<40> G<> G<>$/<2F>!H<01>!1<>17<31><16><07><1F>B<01> B<01>
'<27> ><3E>?<3F> %<25>'<27> 'rc<00><><00>|<01>d}tjjj|<01>}ddg|j d<04>d<05>S)z+Generate a bad request HTTP error response.z Bad Requestz400 BAD REQUESTr<54>ryr<><00>rr5r6<00>dumpsr<73><00>rNr s r<00> _bad_requestzBaseServer._bad_requestsE<00><00> <12>?<3F>#<23>G<EFBFBD><18>-<2D>-<2D>$<24>$<24>*<2A>*<2A>7<EFBFBD>3<><07>+<2B>:<3A>;<3B>#<23>N<EFBFBD>N<EFBFBD>7<EFBFBD>3<>5<> 5rc<00><00>ddgdd<04>S)z0Generate a method not found HTTP error response.z405 METHOD NOT FOUNDr<44>sMethod Not Foundr<64>rrWs r<00>_method_not_foundzBaseServer._method_not_found s<00><00>0<>:<3A>;<3B>/<2F>1<> 1rc<00><><00>|<01>d}tjjj|<01>}ddg|j d<04>d<05>S)z,Generate a unauthorized HTTP error response.<2E> Unauthorizedz401 UNAUTHORIZED)r<>zapplication/jsonryr<>r<>r<>s r<00> _unauthorizedzBaseServer._unauthorizedsE<00><00> <12>?<3F>$<24>G<EFBFBD><18>-<2D>-<2D>$<24>$<24>*<2A>*<2A>7<EFBFBD>3<><07>,<2C>@<40>A<>#<23>N<EFBFBD>N<EFBFBD>7<EFBFBD>3<>5<> 5rc
<00><><00>g}d|vr<>d|vr<>|jdj|d|d<00><04><00>d|vsd|vr<>|jd|d<00>jd<07>dj <00>}|jdj||jd|d<00>jd<07>dj <00><00><04><00>|j
<00>|}|S|j
d k(rd}|St |j
t<00>r|j
g}|St|j
<00>r+|jd
<EFBFBD>}|j |<05>r|g}|Sg}|S|j
}|S) Nzwsgi.url_scheme<6D> HTTP_HOSTz{scheme}://{host})<02>scheme<6D>host<73>HTTP_X_FORWARDED_PROTO<54>HTTP_X_FORWARDED_HOST<53>,r<00>*<2A> HTTP_ORIGIN) <09>append<6E>formatr<74><00>split<69>stripr*r!rJr<>)rN<00>environ<6F>default_originsr<73><00>allowed_origins<6E>origins r<00>_cors_allowed_originsz BaseServer._cors_allowed_originss<><00><00><1C><0F> <1C><07> '<27>K<EFBFBD>7<EFBFBD>,B<> <1B> "<22> "<22>#6<>#=<3D>#=<3D><1E>0<>1<><07> <0B>8L<38>$><3E>$N<01> O<01>'<27>7<EFBFBD>2<>+<2B>w<EFBFBD>6<> <20><1B><1B>,<2C><1B>-<2D>.<2E>0<>05<30><05>c<EFBFBD>
<EFBFBD>1<EFBFBD>><3E>>C<>e<EFBFBD>g<EFBFBD><17> <20>&<26>&<26>':<3A>'A<>'A<>!<21><07> <0B> <0B>/<2F><17><1B>1E<31>)G<01>GL<47>u<EFBFBD><1F>H!<21>!"<22>)$<24>$)<29>E<EFBFBD>G<EFBFBD>(B<01>(-<2D>.<2E> <10> $<24> $<24> ,<2C>-<2D>O<EFBFBD><1F><1E><12> &<26> &<26>#<23> -<2D>"<22>O<EFBFBD><1F><1E><18><04>1<>1<>3<EFBFBD> 7<>#<23>8<>8<>9<>O<EFBFBD><1F><1E> <16>d<EFBFBD>/<2F>/<2F> 0<><1C>[<5B>[<5B><1D>/<2F>F<EFBFBD><17>,<2C>,<2C>V<EFBFBD>4<> &<26>h<EFBFBD>O<EFBFBD><1F><1E>;=<3D> <1C><1F><1E>#<23>7<>7<>O<EFBFBD><1E>rc<00><><00>|jgk(rgSg}|j|<01>}d|vr|<03>|d|vrd|dfg}|ddk(r|dgz }d|vr |d|dfgz }|jr|dgz }|S) z1Return the cross-origin-resource-sharing headers.r<>zAccess-Control-Allow-Origin<69>REQUEST_METHOD<4F>OPTIONS)zAccess-Control-Allow-MethodszOPTIONS, GET, POST<53>#HTTP_ACCESS_CONTROL_REQUEST_HEADERSzAccess-Control-Allow-Headers)z Access-Control-Allow-Credentials<6C>true)r*r<>r+)rNr<>r<>r<>s r<00> _cors_headerszBaseServer._cors_headers8s<><00><00> <0F> $<24> $<24><02> *<2A><15>I<EFBFBD><14><07><1E>4<>4<>W<EFBFBD>=<3D><0F> <18>G<EFBFBD> #<23> <20>(<28>G<EFBFBD>M<EFBFBD>,B<> <20>-!<21>5<>w<EFBFBD>}<7D>7M<37>N<>O<>G<EFBFBD> <12>#<23> $<24> <09> 1<> <13>N<>O<> O<>G<EFBFBD> 0<>G<EFBFBD> ;<3B> <13>7<><1F> E<>F<>H<01>I<01> I<01>G<EFBFBD> <0F> <20> <20> <13>D<>E<> E<>G<EFBFBD><16>rc<00><><00>tj<00>}tj|d<01><02>5}|j |<01>ddd<03>|j <00>S#1swY|j <00>SxYw)z%Apply gzip compression to a response.<2E>w)<02>fileobjrRN)r<><00>BytesIOr<00>GzipFile<6C>write<74>getvalue)rNr<><00>bytesio<69>gzs r<00>_gzipzBaseServer._gzipLsR<00><00><14>*<2A>*<2A>,<2C><07> <11>]<5D>]<5D>7<EFBFBD><13> 5<><12> <0E>H<EFBFBD>H<EFBFBD>X<EFBFBD> <1E>6<><16><1F><1F>!<21>!<21>6<><16><1F><1F>!<21>!<21>s <00>A<03>A.c<00>,<00>tj|<01>S)z(Apply deflate compression to a response.)<02>zlib<69>compress)rNr<>s r<00>_deflatezBaseServer._deflateSs<00><00><13>}<7D>}<7D>X<EFBFBD>&<26>&rc<00><><00>||jvr:|jj|dz<00>|jj|<02>y|jj |<01>y)zWLog message with logging.ERROR level the first time, then log
with given level.zC (further occurrences of this error will be logged with level INFO)N)r0r8<00>error<6F>addrM)rNr <00> message_keys rr<>zBaseServer._log_error_onceWsY<00><00> <17>d<EFBFBD>3<>3<> 3<> <10>K<EFBFBD>K<EFBFBD> <1D> <1D>g<EFBFBD>)@<01>@<01> A<01> <10> !<21> !<21> %<25> %<25>k<EFBFBD> 2<> <10>K<EFBFBD>K<EFBFBD> <1C> <1C>W<EFBFBD> %r)N<><00>i@BTTiNNTFNTNNr_)NNN)rrr<00>compression_methodsrcrKr1r<>rrUrGrBrdrTrnrrrtr<>r<>r<>rfr<>r<>r<>r<>r<>r<>r<>r<>r<>rrrrrs<><00><00>!<21>9<EFBFBD>-<2D><17>6<>K<EFBFBD>!<21>;<3B>/<2F><14>#<23><1C><17>O<EFBFBD> ,<2C> ,<2C>HJ<01>>B<>>B<>37<33>;?<3F>GK<47> MH<01>^<15>C<01>(<1D>TL<01>5<>*<2A>5<>F<01> <16> <1D> <11> '<27>5<>1<> 5<><1F>8<17>("<22>'<27>&rr) r~rrEr<>r;r<>r<><00>rr<00> getLoggerr9rrrr<00><module>r<>s?<00><01> <0A> <0B><10> <09><0E><0E> <0B><14><15>"<22><17>"<22>"<22>#4<>5<><0E>P&<26>P&r