Commit fcf74657 authored by skummer's avatar skummer

ZP-278 #comment when a foldersync with synckey 0 is requested the as version...

ZP-278 #comment when a foldersync with synckey 0 is requested the as version headers need to be returned #time 1h

git-svn-id: https://z-push.org/svn/z-push/trunk@1543 b7dd7b3b-3a3c-0410-9da9-bee62a6cc5b5
parent 49fc84a6
...@@ -182,6 +182,10 @@ include_once('version.php'); ...@@ -182,6 +182,10 @@ include_once('version.php');
if(!RequestProcessor::HandleRequest()) if(!RequestProcessor::HandleRequest())
throw new WBXMLException(ZLog::GetWBXMLDebugInfo()); throw new WBXMLException(ZLog::GetWBXMLDebugInfo());
// eventually the RequestProcessor wants to send other headers to the mobile
foreach (RequestProcessor::GetSpecialHeaders() as $header)
header($header);
// stream the data // stream the data
$len = ob_get_length(); $len = ob_get_length();
$data = ob_get_contents(); $data = ob_get_contents();
......
...@@ -67,6 +67,13 @@ class FolderSync extends RequestProcessor { ...@@ -67,6 +67,13 @@ class FolderSync extends RequestProcessor {
if(!self::$decoder->getElementEndTag()) if(!self::$decoder->getElementEndTag())
return false; return false;
// every FolderSync with SyncKey 0 should return the supported AS version & command headers
if($synckey == "0") {
self::$specialHeaders = array();
self::$specialHeaders[] = ZPush::GetSupportedProtocolVersions();
self::$specialHeaders[] = ZPush::GetSupportedCommands();
}
$status = SYNC_FSSTATUS_SUCCESS; $status = SYNC_FSSTATUS_SUCCESS;
$newsynckey = $synckey; $newsynckey = $synckey;
try { try {
......
...@@ -55,6 +55,7 @@ abstract class RequestProcessor { ...@@ -55,6 +55,7 @@ abstract class RequestProcessor {
static protected $decoder; static protected $decoder;
static protected $encoder; static protected $encoder;
static protected $userIsAuthenticated; static protected $userIsAuthenticated;
static protected $specialHeaders;
/** /**
* Authenticates the remote user * Authenticates the remote user
...@@ -126,6 +127,19 @@ abstract class RequestProcessor { ...@@ -126,6 +127,19 @@ abstract class RequestProcessor {
return $handler->Handle(Request::GetCommandCode()); return $handler->Handle(Request::GetCommandCode());
} }
/**
* Returns any additional headers which should be sent to the mobile
*
* @access public
* @return array
*/
static public function GetSpecialHeaders() {
if (!isset(self::$specialHeaders) || !is_array(self::$specialHeaders))
return array();
return self::$specialHeaders;
}
/** /**
* Handles a command * Handles a command
* *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment