Exemple #1
0
    // then it will be sent as a chunked packet anyway because PHP will have to flush
    // the buffer.
    if (!headers_sent()) {
        header("Content-Length: {$len}");
    }
    // send vnd.ms-sync.wbxml content type header if there is no content
    // otherwise text/html content type is added which might break some devices
    if ($len == 0) {
        header("Content-Type: application/vnd.ms-sync.wbxml");
    }
    print $data;
    // destruct backend after all data is on the stream
    $backend->Logoff();
} catch (NoPostRequestException $nopostex) {
    if ($nopostex->getCode() == NoPostRequestException::OPTIONS_REQUEST) {
        header(ZPush::GetServerHeader());
        header(ZPush::GetSupportedProtocolVersions());
        header(ZPush::GetSupportedCommands());
        ZLog::Write(LOGLEVEL_INFO, $nopostex->getMessage());
    } else {
        if ($nopostex->getCode() == NoPostRequestException::GET_REQUEST) {
            if (Request::GetUserAgent()) {
                ZLog::Write(LOGLEVEL_INFO, sprintf("User-agent: '%s'", Request::GetUserAgent()));
            }
            if (!headers_sent() && $nopostex->showLegalNotice()) {
                ZPush::PrintZPushLegal('GET not supported', $nopostex->getMessage());
            }
        }
    }
} catch (Exception $ex) {
    if (Request::GetUserAgent()) {