Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117831586
D4650.1775303032.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
4 KB
Referenced Files
None
Subscribers
None
D4650.1775303032.diff
View Options
diff --git a/lib/ext/Syncroton/Server.php b/lib/ext/Syncroton/Server.php
--- a/lib/ext/Syncroton/Server.php
+++ b/lib/ext/Syncroton/Server.php
@@ -165,6 +165,11 @@
if (!$response) {
$response = $command->getResponse();
}
+
+ if ($response === null) {
+ // FIXME: Is this really needed? It is for PHP cli-server, but not really for a real http server
+ header('Content-Length: 0');
+ }
} catch (Syncroton_Exception_ProvisioningNeeded $sepn) {
if ($this->_logger instanceof Zend_Log) {
$this->_logger->info(__METHOD__ . '::' . __LINE__ . " provisioning needed");
diff --git a/lib/kolab_sync_data_email.php b/lib/kolab_sync_data_email.php
--- a/lib/kolab_sync_data_email.php
+++ b/lib/kolab_sync_data_email.php
@@ -513,7 +513,10 @@
$is_ios = preg_match('/(iphone|ipad)/i', $this->device->devicetype);
// attachments
- $attachments = array_merge($message->attachments, $message->inline_parts);
+ $attachments = $message->attachments;
+ if (isset($message->inline_parts)) {
+ $attachments = array_merge($attachments, $message->inline_parts);
+ }
if (!empty($attachments)) {
$result['attachments'] = [];
$attachment_ids = [];
diff --git a/tests/Sync/Sync/EmailTest.php b/tests/Sync/Sync/EmailTest.php
--- a/tests/Sync/Sync/EmailTest.php
+++ b/tests/Sync/Sync/EmailTest.php
@@ -112,29 +112,7 @@
$this->assertSame('test sync', $xpath->query("{$root}/ns:ApplicationData/Email:Subject")->item(0)->nodeValue);
// List the rest of the mail
- $request = <<<EOF
- <?xml version="1.0" encoding="utf-8"?>
- <!DOCTYPE AirSync PUBLIC "-//AIRSYNC//DTD AirSync//EN" "http://www.microsoft.com/">
- <Sync xmlns="uri:AirSync" xmlns:AirSyncBase="uri:AirSyncBase">
- <Collections>
- <Collection>
- <SyncKey>{$syncKey}</SyncKey>
- <CollectionId>{$folderId}</CollectionId>
- <DeletesAsMoves>1</DeletesAsMoves>
- <GetChanges>1</GetChanges>
- <Options>
- <FilterType>0</FilterType>
- <Conflict>1</Conflict>
- <BodyPreference xmlns="uri:AirSyncBase">
- <Type>2</Type>
- <TruncationSize>51200</TruncationSize>
- <AllOrNone>0</AllOrNone>
- </BodyPreference>
- </Options>
- </Collection>
- </Collections>
- </Sync>
- EOF;
+ $request = preg_replace('|<SyncKey>\d</SyncKey>|', "<SyncKey>{$syncKey}</SyncKey>", $request);
$response = $this->request($request, 'Sync');
@@ -175,6 +153,22 @@
$this->assertSame('foo4foo1@bar.net', $xpath->query('AirSyncBase:ContentId', $att)->item(0)->nodeValue);
$this->assertSame('fiction1/fiction2', $xpath->query('AirSyncBase:ContentLocation', $att)->item(0)->nodeValue);
+ // Test the empty Sync response
+ $request = preg_replace('|<SyncKey>\d</SyncKey>|', "<SyncKey>{$syncKey}</SyncKey>", $request);
+
+ $response = $this->request($request, 'Sync');
+
+ // According to https://learn.microsoft.com/en-us/openspecs/exchange_server_protocols/ms-ascmd/b4b366a5-7dfb-45a9-a256-af8fa7c53400
+ // the empty response should look like this
+ //
+ // HTTP/1.1 200 OK
+ // Date: Fri, 10 Apr 2009 20:32:39 GMT
+ // Content-Length: 0
+
+ $this->assertSame(200, $response->getStatusCode());
+ $this->assertSame('', (string) $response->getBody());
+ $this->assertSame(['0'], $response->getHeader('Content-Length'));
+
return $syncKey;
}
diff --git a/tests/SyncTestCase.php b/tests/SyncTestCase.php
--- a/tests/SyncTestCase.php
+++ b/tests/SyncTestCase.php
@@ -444,7 +444,7 @@
if (method_exists("PHPUnit\Framework\TestCase", "assertMatchesRegularExpression")) {
parent::assertMatchesRegularExpression($arg1, $arg2, $message);
} else {
- parent::assertRegExp($arg1, $arg2);
+ parent::assertRegExp($arg1, $arg2, $message);
}
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Apr 4, 11:43 AM (11 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18829276
Default Alt Text
D4650.1775303032.diff (4 KB)
Attached To
Mode
D4650: Set Content-Length:0 for an empty Sync response
Attached
Detach File
Event Timeline