summaryrefslogtreecommitdiffstats
path: root/src/ogRest.py
diff options
context:
space:
mode:
authorAlvaro Neira Ayuso <aneira@soleta.eu>2019-12-27 14:37:12 +0100
committerAlvaro Neira Ayuso <alvaroneay@gmail.com>2020-01-19 19:50:44 +0100
commit6764fc44e1391c21de4d838b409fe26a3f6e1945 (patch)
treedb51bbcf934c4303b934c6c178b2d58335108220 /src/ogRest.py
parente20daf639dd271268b172b42adc0d1b9d2103883 (diff)
Split the commands taking into account GET/POST operations
Diffstat (limited to 'src/ogRest.py')
-rw-r--r--src/ogRest.py26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/ogRest.py b/src/ogRest.py
index ac02a4f..cec6aa8 100644
--- a/src/ogRest.py
+++ b/src/ogRest.py
@@ -42,16 +42,22 @@ class ogRest():
return msg
def processOperation(self, op, URI, cmd, client):
- if ("poweroff" in URI):
- self.process_poweroff(client)
- elif ("reboot" in URI):
- self.process_reboot(client)
- elif ("probe" in URI):
- self.process_probe(client)
- elif ("shell/run" in URI):
- self.process_shellrun(client, cmd)
- elif ("shell/output" in URI):
- self.process_shellout(client)
+ if ("GET" in op):
+ if ("probe" in URI):
+ self.process_probe(client)
+ elif ("shell/output" in URI):
+ self.process_shellout(client)
+ else:
+ client.send(self.getResponse(ogResponses.BAD_REQUEST))
+ elif ("POST" in op):
+ if ("poweroff" in URI):
+ self.process_poweroff(client)
+ elif ("reboot" in URI):
+ self.process_reboot(client)
+ elif ("shell/run" in URI):
+ self.process_shellrun(client, cmd)
+ else:
+ client.send(self.getResponse(ogResponses.BAD_REQUEST))
else:
client.send(self.getResponse(ogResponses.BAD_REQUEST))