File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -377,10 +377,12 @@ def handle(self):
377377 Overrides the base class method to define how incoming data is handled.
378378
379379 By default:
380- Processes the incoming data from the client, logs the messages,
381- and sends a response back. If the data contains the
382- keyword "STOP", it raises a `RuntimeError` to
383- initiate server shutdown.
380+ Processes the incoming data from the client, logs the messages,
381+ and sends a response back. If the data contains the
382+ keyword "STOP", it raises a `RuntimeError` to
383+ initiate server shutdown.
384+ Silently ignores any UnicodeDecodeError when decoding data.
385+ Returns early if data or socket is None.
384386
385387 Minimal Acceptance Testing:
386388
@@ -429,7 +431,7 @@ def handle(self):
429431 try :
430432 data = data .decode ('utf8' ) if isinstance (data , bytes ) else str (data )
431433 except UnicodeDecodeError : # pragma: no cover
432- return # nothing to do -- fail quickly.
434+ return # silently ignore invalid UTF-8 data -- fail quickly.
433435 if (_sys .stdout .isatty ()): # pragma: no cover
434436 print (f"{ self .client_address [0 ]} SAYS: { data .strip ()} to ALL" )
435437 if data is not None :
You can’t perform that action at this time.
0 commit comments