summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ogClient.py7
-rw-r--r--src/ogProcess.py4
2 files changed, 8 insertions, 3 deletions
diff --git a/src/ogClient.py b/src/ogClient.py
index 05c243d..3f7a752 100644
--- a/src/ogClient.py
+++ b/src/ogClient.py
@@ -85,9 +85,10 @@ class ogClient:
httpparser.parser(self.data)
print httpparser.getRequestOP()
print httpparser.getURI()
- ogprocess.processOperation(httpparser.getRequestOP(), httpparser.getURI())
-
- self.sock.send("HTTP/1.0 200 OK\r\n\r\n")
+ if not ogprocess.processOperation(httpparser.getRequestOP(), httpparser.getURI()):
+ self.sock.send("HTTP/1.0 400 Bad request\r\n\r\n")
+ else:
+ self.sock.send("HTTP/1.0 200 OK\r\n\r\n")
# Cleanup state information from request
self.data = ""
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