下载大文件失败,Squid + c-icap + SquidClamAV

我正在用Squid&SquidClamAV构build一个新的代理服务器。

我正在下载大文件时遇到问题。 我在squidclamav.conf中设置了52428800字节的最大大小 – 这应该防止大于50MB的文件的扫描。

通过代理下载高达2GB的任何东西都可以正常工作,但是大于此值的文件会产生以下错误: ICAP协议错误 – 系统返回:(32)损坏的pipe道

在c – icap服务器日志中我得到这个: 2011年5月10日星期五10:19:36,一般,服务中的错误。 请向服务人员报告!

以2GB以下的大小下载文件会立即向浏览器下载窗口。 正如所料。

当开始下载大于2GB的内容时,在产生错误之前需要一些时间。 在/ var / tmp之后,我看到它实际上开始下载文件高达50MB(在squidclamav.conf中设置的最大大小!),然后停止并产生错误。

我不明白为什么这个文件比squidclamav中的maxsize大。

该服务器是一个CentOS 6 32位机器。 C-icap从source(v0.1.7)编译,squid来自CentOS,clamd + squidclamav来自repoforge.org。 下面我已经添加了相关的configuration文件。

/etc/squid/squid.conf中:

... icap_enable on icap_send_client_ip on icap_send_client_username on icap_client_username_header X-Authenticated-User icap_service service_req reqmod_precache \ bypass=1 icap://127.0.0.1:1344/squidclamav adaptation_access service_req allow all icap_service service_resp respmod_precache \ bypass=1 icap://127.0.0.1:1344/squidclamav adaptation_access service_resp allow all 

/etc/squidclamav.conf:

 maxsize 52428800 redirect http://localproxy/detecteio.php clamd_local /var/run/clamav/clamd.sock timeout 1 logredir 0 dnslookup 1 

/etc/c-icap.conf:

 PidFile /var/run/c-icap/c-icap.pid CommandsSocket /var/run/c-icap/c-icap.ctl Timeout 300 MaxKeepAliveRequests 100 KeepAliveTimeout 600 StartServers 3 MaxServers 10 MinSpareThreads 10 MaxSpareThreads 20 ThreadsPerChild 10 MaxRequestsPerChild 0 Port 1344 ServerAdmin root@localhost ServerName localproxy.domain.local TmpDir /var/tmp MaxMemObject 131072 DebugLevel 1 ModulesDir /usr/local/lib/c_icap ServicesDir /usr/local/lib/c_icap TemplateDir /usr/local/share/c_icap/templates/ TemplateDefaultLanguage en LoadMagicFile /usr/local/etc/c-icap.magic RemoteProxyUsers off RemoteProxyUserHeader X-Authenticated-User RemoteProxyUserHeaderEncoded on ServerLog /var/log/c-icap_server.log AccessLog /var/log/c-icap_access.log Service squidclamav squidclamav.so Service echo srv_echo.so 

/etc/clamd.conf:

 LogFile /var/log/clamav/clamd.log LogFileMaxSize 0 LogTime yes LogSyslog yes PidFile /var/run/clamav/clamd.pid TemporaryDirectory /var/tmp DatabaseDirectory /var/clamav LocalSocket /var/run/clamav/clamd.sock FixStaleSocket yes TCPSocket 3310 TCPAddr 127.0.0.1 MaxConnectionQueueLength 30 MaxThreads 50 ReadTimeout 300 User clamav AllowSupplementaryGroups yes ScanPE yes ScanELF yes DetectBrokenExecutables yes ScanOLE2 yes ScanMail yes ScanArchive yes ArchiveBlockEncrypted no 

一般来说,32位系统在处理大于2GB的文件时会遇到麻烦,但是,下载限制为50MB则表明ClamAV存在问题。

几个build议;

1)确保Squid已经被编译为“–with-large-files”

2)使用curl或wget在本地testing本地下载(排除浏览器/networking问题)

3)尝试增加'/etc/squidclamav.conf'中的'maxsize'指令来查看是否可以下载较大的文件。

4)禁用文件扫描和重新testing。

根据提供的configuration,似乎这个问题不是因为鱿鱼,因为configuration的限制是50MB,这是防止扫描文件大于这个限制,但它与下载文件的大小无关。 您可以确认使用下载的Web浏览器的名称和版本,因为有些Internet Explorer版本只允许下载less于特定大小的文件。 例如,如果您尝试在IE6中下载大于2 GB的文件,或者在Internet Explorer 7中大于4 GB的文件,则可能会发生这种情况,在这种情况下,您可能会切换到Firefox或任何其他Web浏览器。 注意:这个下载限制已经在IE8中删除了。 因此,您不应该在IE8中遇到这种情况。 您可以参考此链接了解更多信息http://support.microsoft.com/kb/298618我希望这些信息对您有所帮助

代理服务器是用64bit Centos 6重build的。使用了相同的configuration,但问题已经消失。