Skip to content

Commit 7bc4744

Browse files
committed
In case of 204 status stop reading and consider the content to be clean
1 parent dd04ef1 commit 7bc4744

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

lib/Scanner/ICAPClient.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,17 @@ private function send(string $request): array {
110110
);
111111
}
112112

113-
// read header
114-
$protocol = $this->readIcapStatusLine();
115-
$headers = $this->readHeaders();
113+
$headers = [];
116114
$resHdr = [];
117-
if (isset($headers['Encapsulated'])) {
118-
$resHdr = $this->parseResHdr($headers['Encapsulated']);
115+
$protocol = $this->readIcapStatusLine();
116+
117+
// McAfee seems to not properly close the socket once all response bytes are sent to the client
118+
// So if ICAP status is 204 we just stop reading
119+
if ($protocol['code'] !== 204) {
120+
$headers = $this->readHeaders();
121+
if (isset($headers['Encapsulated'])) {
122+
$resHdr = $this->parseResHdr($headers['Encapsulated']);
123+
}
119124
}
120125

121126
$this->disconnect();

0 commit comments

Comments
 (0)