Skip to content

Commit

Permalink
In case of 204 status stop reading and consider the content to be clean
Browse files Browse the repository at this point in the history
  • Loading branch information
VicDeo committed May 27, 2021
1 parent dd04ef1 commit 7bc4744
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions lib/Scanner/ICAPClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,17 @@ private function send(string $request): array {
);
}

// read header
$protocol = $this->readIcapStatusLine();
$headers = $this->readHeaders();
$headers = [];
$resHdr = [];
if (isset($headers['Encapsulated'])) {
$resHdr = $this->parseResHdr($headers['Encapsulated']);
$protocol = $this->readIcapStatusLine();

// McAfee seems to not properly close the socket once all response bytes are sent to the client
// So if ICAP status is 204 we just stop reading
if ($protocol['code'] !== 204) {
$headers = $this->readHeaders();
if (isset($headers['Encapsulated'])) {
$resHdr = $this->parseResHdr($headers['Encapsulated']);
}
}

$this->disconnect();
Expand Down

0 comments on commit 7bc4744

Please sign in to comment.