-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ICAP] Stop reading the response after headers are read #445
Conversation
d6d5907
to
d910f33
Compare
@jnweiger if it possible to test this patch before merge? |
OK. I'll give it a test first, then we merge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this patch, an infected file is reported immediately.
A clean file hangs for 60 seconds in 'processing file'.
Seen with McAfee via ICAP.
ClamAV and Kaspersky via ICAP work fine.
So is it acceptable or not? |
@janackermann could you please sign the CLA for this repo? |
Done |
Kudos, SonarCloud Quality Gate passed! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codewise LGTM
Do not read the whole response as we need only ICAP headers and
Encapsulated
header.So we read ICAP headers one by one until
Encapsulated
header is met.Then we parse offsets provided by
res-hdr
andres-body
of this header.the content is considered to be infected if ANY of the following is true:
av_response_header
res-hdr
section has status code403
the content is considered to be clean if the ICAP status code is
204
TL;DR
McAfee just hangs so if we want to read whole response we should wait until the network timeout happens
But the whole response is not needed for the virus detection as
Fixes #443 https://github.com/owncloud/enterprise/issues/4580
Obsoletes #444