Hi Alexander,

I assume that you have gzip encoding activated in your apache server.

In that case, when I normally request for an object, I do find 2 entries in the 
cache - one which says it is internal request, and the other with a 
Accept-encoding set to gzip + actual gzipped content.

In short, I do feel squid caches the replies but with an additional entry..

Regards,
Anita

-----Original Message-----
From: Alexander Komyagin [mailto:[email protected]] 
Sent: 09 July 2012 19:44
To: [email protected]
Subject: Caching responses with "Vary" responses

Hi! I've just noticed that when remote server replies with Vary header
parameter set, squid won't cache that reply. For example:

aaa@bbb:~$ wget -O /dev/null -S http://www.ietf.org/rfc/rfc3280.txt
--2012-07-09 18:03:20--  http://www.ietf.org/rfc/rfc3280.txt
Connecting to 10.0.0.89:3128... connected.
Proxy request sent, awaiting response... 
  HTTP/1.1 200 OK
  Date: Mon, 09 Jul 2012 14:03:55 GMT
  Server: Apache/2.2.10 (Linux/SUSE) mod_ssl/2.2.10 OpenSSL/0.9.8h
PHP/5.2.13 with Suhosin-Patch mod_python/3.3.1 Python/2.6 mod_wsgi/3.3
mod_perl/2.0.4 Perl/v5.10.0
  Last-Modified: Fri, 10 May 2002 00:17:43 GMT
  ETag: "9fe907-48284-3a095ba1a77c0"
  Accept-Ranges: bytes
  Content-Length: 295556
  Vary: Accept-Encoding
  Content-Type: text/plain
  X-Cache: MISS from my_proxy
  Via: 1.1 my_proxy (squid/3.2.0.16)
  Connection: close
Length: 295556 (289K) [text/plain]


Reason:
StoreEntry::setPublicKey() is called for the reply, since originally it
seems cacheable, but when "vary" header is detected

/* if (mem_obj->vary_headers && !storeGetPublic(mem_obj->url,
mem_obj->method)) */

squid creates new StoreEntry (which is created with KEY_PRIVATE flag
set, since neighbors_do_private_keys is 1) and
writes to it -- this way the result won't be stored because KEY_PRIVATE
is set (I failed to find any place where this flag shall be
cleared).

Is this behavior normal? Or is it a bug or something?

-- 
Best wishes,
Alexander Komyagin


Please do not print this email unless it is absolutely necessary. 

The information contained in this electronic message and any attachments to 
this message are intended for the exclusive use of the addressee(s) and may 
contain proprietary, confidential or privileged information. If you are not the 
intended recipient, you should not disseminate, distribute or copy this e-mail. 
Please notify the sender immediately and destroy all copies of this message and 
any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should 
check this email and any attachments for the presence of viruses. The company 
accepts no liability for any damage caused by any virus transmitted by this 
email. 

www.wipro.com

Reply via email to