From ae7a970b505b23d2658f045cfebec318989613db Mon Sep 17 00:00:00 2001 From: Tobias Hintze Date: Mon, 5 Aug 2013 21:58:48 +0200 Subject: [PATCH] "fix" otpoll.php --- ajax/otpoll.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ajax/otpoll.php b/ajax/otpoll.php index 51150875..cd6eaa8b 100644 --- a/ajax/otpoll.php +++ b/ajax/otpoll.php @@ -51,6 +51,13 @@ function bogusSession($i){ } $command = isset($_POST['command']) ? $_POST['command'] : ''; +// sorry - but currently the whole body is the message... +$postbody = file_get_contents('php://input'); +if (preg_match('/(^[^:]*):/', $postbody, $matches)) { + $command = $matches[1]; +} else { + $command = ''; +} $response = array(); switch ($command){ @@ -58,7 +65,7 @@ switch ($command){ $response["session_list"] = array(bogusSession(0), bogusSession(1)); break; case 'join-session': - + $response = "true"; // should fail when session is non-existent break; case 'sync-ops': // completely bogus @@ -82,6 +89,9 @@ switch ($command){ break; default: header('HTTP/1.1 400: BAD REQUEST'); + print(""); + print("bad request: [$command]"); + print(""); exit(); }