Re: [squid-users] Hello, can 'squidclient' check if a file is cached in the squid?

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Wed, 23 Jan 2013 23:26:50 +1300

On 23/01/2013 9:13 p.m., He, Qingsheng 2 wrote:
> Hello Amos,
>
> Thanks for the reply!
>
> The URL is like http://<FQND>/folder1/folder2/..../xxx.zip
>
> If I use the ICP query by the per script it returned below:
>
> UDP_HIT http://<FQND>/folder1/folder2/..../xxx.zip
>
> But if I use below squidclient to request:
> Squidclient -h localhost -p 80 -t 1 $URL
>
> It return:
>
> HTTP/1.0 405 Method Not Allowed
> Date: Wed, 23 Jan 2013 08:09:09 GMT
> Server: Apache/2.2.14 (Ubuntu)
> Allow:
> Vary: Accept-Encoding

Aha! the Vary header.

ICP operates with *only* the URL when deciding HIT/MISS. The Vary header
means that there could be any one of multiple different objects stored
for the one URL - this is a common cause of ICP producing false results.
Only a lookup request with full HTTP request headers will be able to
determine accurately whether the HTTP fetch will be a HIT or MISS. In
your case it is a MISS with different Accept-Encoding headers from the
original client and the squidclient tool (or two different clients).

So .... I suggest moving to the HTCP protocol which is an upgrade from
ICP that can handle HTTP/1.1 header features like Vary.
Lookup htcp_port, htcp_access and cache_peer htcp= options.

Amos
Received on Wed Jan 23 2013 - 10:27:06 MST

This archive was generated by hypermail 2.2.0 : Wed Jan 23 2013 - 12:00:05 MST