diff options
author | Alvaro Neira Ayuso <aneira@soleta.eu> | 2019-12-12 18:27:39 +0100 |
---|---|---|
committer | Alvaro Neira Ayuso <alvaroneay@gmail.com> | 2020-01-19 19:50:44 +0100 |
commit | 2d72f00d95339d15764580bc0ebcfcfc04b4854d (patch) | |
tree | 068b27ddc4578c42b3d2e311922b5fe0317045ef /src/ogProcess.py | |
parent | fdf7701a039b36beebb05296dbf28a10bd5588d2 (diff) |
Send bad request when the APIRest operation is not supported
Our program sends always the HTTP message:
HTTP/1.0 200 OK
but if the operation sent is not supported, we are sending the same correct
message. This patch add the support to check if the message is supported.
If the message is not supported, we are going to send:
HTTP/1.0 400 Bad request\r\n\r\n
Otherwise, in operations supported:
HTTP/1.0 200 OK
Diffstat (limited to 'src/ogProcess.py')
-rw-r--r-- | src/ogProcess.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/ogProcess.py b/src/ogProcess.py index ff78f34..a2fca8b 100644 --- a/src/ogProcess.py +++ b/src/ogProcess.py @@ -11,8 +11,12 @@ class ogProcess(): def processOperation(self, op, URI): if ("poweroff" in URI): self.process_poweroff() + return 1 elif ("reboot" in URI): self.process_reboot() + return 1 + + return 0 def process_reboot(self): # Rebooting thread |