Skip to content

Commit 0a2e834

Browse files
authored
Merge pull request #500 from owncloud/fix_icap_proto_preview_case
Another attempt to fix the ICAP encapsulation
2 parents be182db + ca63c2d commit 0a2e834

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

lib/Scanner/ICAPClient.php

+10-2
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,21 @@ public function getRequest(string $method, string $service, array $body = [], ar
5555
switch ($type) {
5656
case 'req-hdr':
5757
case 'res-hdr':
58-
$encapsulated[$type] = \strlen($bodyData);
58+
if (\array_key_exists('Preview', $headers)) {
59+
$encapsulated[$type] = \strlen($data); # McAfee Webgateway
60+
} else {
61+
$encapsulated[$type] = \strlen($bodyData); # ClamAV and Fortinet
62+
}
5963
$bodyData .= $data;
6064
break;
6165

6266
case 'req-body':
6367
case 'res-body':
64-
$encapsulated[$type] = \strlen($bodyData);
68+
if (\array_key_exists('Preview', $headers)) {
69+
$encapsulated[$type] = \strlen($data); # McAfee Webgateway
70+
} else {
71+
$encapsulated[$type] = \strlen($bodyData); # ClamAV and Fortinet
72+
}
6573
$bodyData .= \dechex(\strlen($data)) . "\r\n";
6674
$bodyData .= $data;
6775
$bodyData .= "\r\n";

0 commit comments

Comments
 (0)