From 7e06238602fa87352450820051043971ce41cc8b Mon Sep 17 00:00:00 2001 From: swee Date: Mon, 9 Dec 2024 10:22:43 -0800 Subject: [PATCH] Update server.py --- server.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/server.py b/server.py index 8b347eb..348e3c4 100644 --- a/server.py +++ b/server.py @@ -163,12 +163,18 @@ def session(connection, client): connection.sendall(bytes(f"ERROR :Closing Link: {client[0]} ({msg})\r\n","UTF-8")) connection.close() break + + + + # Ignore empty text + elif text.split(" ")[0] == "": + pass + else: + # Unknown command + cmd = text.split(" ")[0] + connection.sendall(bytes(f":{server} 421 {pending} {cmd} :Unknown command\r\n","UTF-8")) + - elif text.split(" ")[0] == "": - pass - else: - cmd = text.split(" ")[0] - connection.sendall(bytes(f":{server} 421 {pending} {cmd} :Unknown command\r\n","UTF-8")) except: print(traceback.format_exc())