From db7cc0d99ef9f582a79d0ce28c0438085ee98839 Mon Sep 17 00:00:00 2001 From: Alvaro Neira Ayuso Date: Fri, 27 Dec 2019 14:49:14 +0100 Subject: (BUG) Fix crash when json message received is incomplete --- src/HTTPParser.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/HTTPParser.py b/src/HTTPParser.py index 47c2204..912a7cf 100644 --- a/src/HTTPParser.py +++ b/src/HTTPParser.py @@ -34,7 +34,12 @@ class HTTPParser: if not self.contentLen == 0: msgs = self.headersAlone.rstrip().split('\n') cmd = msgs[len(msgs) - 1] - jsoncmd = json.loads(cmd) + try: + jsoncmd = json.loads(cmd) + except ValueError as e: + print ("Error: Json message incomplete") + return + if "run" in cmd: self.cmd = jsoncmd["run"] -- cgit v1.2.3-18-g5258