From f8e566bf63fbc24466e153a713f6474b326a2f1b Mon Sep 17 00:00:00 2001 From: "Jose M. Guisado" Date: Tue, 1 Dec 2020 10:12:50 +0100 Subject: #1000 ogRest: set idle state after processing bad request Before this patch the ogRest would hang indifinitely in a BUSY state when a bad request was received. Fix this by returning ogRest state to IDLE once the corresponding bad request response has been sent. This accounts for the following cases: - Unknown GET action - Unknown POST action - Unknown HTTP verb --- src/ogRest.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/ogRest.py b/src/ogRest.py index c50adfa..d9d6f4a 100644 --- a/src/ogRest.py +++ b/src/ogRest.py @@ -300,6 +300,7 @@ class ogRest(): f'{method[:ogRest.LOG_LENGTH]}') response = restResponse(ogResponses.BAD_REQUEST) client.send(response.get()) + self.state = ThreadState.IDLE elif ("POST" in method): if ("poweroff" in URI): self.process_poweroff(client) @@ -327,9 +328,11 @@ class ogRest(): f'{method[:ogRest.LOG_LENGTH]}') response = restResponse(ogResponses.BAD_REQUEST) client.send(response.get()) + self.state = ThreadState.IDLE else: response = restResponse(ogResponses.BAD_REQUEST) client.send(response.get()) + self.state = ThreadState.IDLE return 0 -- cgit v1.2.3-18-g5258