[squid-users] Squid logs TCP_MISS/200 for a served cached object requested with If-None-Match

Garri Djavadyan garryd at comnet.uz
Fri Nov 18 20:12:24 UTC 2016


Hello,

I noticed that Squid logs TCP_MISS/200 when it serves previously cached 
object in return to non-matched conditional request with If-None-Match. 
For example:

1. Non-conditional request to the previously cached object.

$ curl -v -x http://127.0.0.1:3128 
http://mirror.comnet.uz/centos/7/os/x86_64/GPL >/dev/null

< HTTP/1.1 200 OK
< Server: nginx
< Date: Fri, 18 Nov 2016 19:58:38 GMT
< Content-Type: application/octet-stream
< Content-Length: 18009
< Last-Modified: Wed, 09 Dec 2015 22:35:46 GMT
< ETag: "5668acc2-4659"
< Accept-Ranges: bytes
< Age: 383
< X-Cache: HIT from gentoo.comnet.uz
< Via: 1.1 gentoo.comnet.uz (squid/5.0.0-BZR)
< Connection: keep-alive


2. Conditional request with non-matching entity to the same object.

$ curl -v -x http://127.0.0.1:3128 -H 'If-None-Match: "5668acc2-4658"' 
http://mirror.comnet.uz/centos/7/os/x86_64/GPL >/dev/null

< HTTP/1.1 200 OK
< Server: nginx
< Date: Fri, 18 Nov 2016 19:58:38 GMT
< Content-Type: application/octet-stream
< Content-Length: 18009
< Last-Modified: Wed, 09 Dec 2015 22:35:46 GMT
< ETag: "5668acc2-4659"
< Accept-Ranges: bytes
< X-Cache: MISS from gentoo.comnet.uz
< Via: 1.1 gentoo.comnet.uz (squid/5.0.0-BZR)
< Connection: keep-alive


I found that the behavior is related to the following code 
(client_side_reply.cc):

         if (!e->hasIfNoneMatchEtag(r)) {
             // RFC 2616: ignore IMS if If-None-Match did not match
             r.flags.ims = false;
             r.ims = -1;
             r.imslen = 0;
             r.header.delById(Http::HdrType::IF_MODIFIED_SINCE);
--->        http->logType = LOG_TCP_MISS;
             sendMoreData(result);
             return true;
         }


So, it seems like intended behavior, but I can't understand the reasons.
Or maybe it is a bug?

Thanks.

Garri


More information about the squid-users mailing list