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):
377
377
Overrides the base class method to define how incoming data is handled.
378
378
379
379
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.
384
386
385
387
Minimal Acceptance Testing:
386
388
@@ -429,7 +431,7 @@ def handle(self):
429
431
try :
430
432
data = data .decode ('utf8' ) if isinstance (data , bytes ) else str (data )
431
433
except UnicodeDecodeError : # pragma: no cover
432
- return # nothing to do -- fail quickly.
434
+ return # silently ignore invalid UTF-8 data -- fail quickly.
433
435
if (_sys .stdout .isatty ()): # pragma: no cover
434
436
print (f"{ self .client_address [0 ]} SAYS: { data .strip ()} to ALL" )
435
437
if data is not None :
You can’t perform that action at this time.
0 commit comments