varnish not generating 304 in case multiple etags are used.

Mark Nottingham mnot at yahoo-inc.com
Tue Apr 26 02:31:04 CEST 2011


An ETag header can only contain one ETag. See:
  http://tools.ietf.org/html/draft-ietf-httpbis-p4-conditional-14#section-2.2

Cheers,


On 23/04/2011, at 10:28 PM, Harm Verhagen wrote:

> Hi,
> 
> I'm having a problem with the handling of http responses that contain multiple etag headers.  I think varnish does not handle this case as effecient as it can. (And therefor I suspect a bug in varnish).
> What do you think?
> 
> 
> steps to reproduce
> ==============
> See request/response below. Force a reload of a cached item in browser: Cache-Control: max-age=0 
> 
> result
> ====
> HTTP 200 is returned, varnish serves file content, varnish does NOT contact backend.
> 
> expected result
> ============
> HTTP 304 is returned, varnish does not server file content, varnish does NOT contact backend.
> 
> NOTE
> =====
> This does work correct, in case  the reply contains a SINGLE  etag header. -> all works as expected, I get a nice 304 instead of a 200.
> As soon as the reply contains TWO etag headers, it seems varnish never returns a 304. Which I think is incorrect. No ?
> 
> Note; This is not related to the vlc, as single etag headers are working fine.  (I'm doing NOTHING  with headers, etag or others in my vlc).
> 
> request (anonimised)
> =======
> GET /dam/asset/download/uuid/121a8df4-4fe8-11e0-bd65-56167b3dc56d/variant/103/ HTTP/1.1
> Host: X.X.X
> User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0) Gecko/20100101 Firefox/4.0
> Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
> Accept-Language: nl,en-us;q=0.7,en;q=0.3
> Accept-Encoding: gzip, deflate
> Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
> Keep-Alive: 115
> Connection: keep-alive
> Cookie: __utma=1.1741069999.1296235686.1303504321.1303507491.8;  <snipped rest of cookie>
> If-Modified-Since: Fri, 22 Apr 2011 13:00:00 GMT
> If-None-Match: "d41d8cd98f00b204e9800998ecf8427e", "4a00e1-3ddf-4a1816f7a9400"
> Cache-Control: max-age=0
> 
> 
> reply
> HTTP/1.1 200 OK
> Server: Apache/2.2.14 (Ubuntu)
> Content-Disposition: inline; filename="Seminar Speakers.jpg"
> Expires: Sat, 23 Apr 2011 13:00:00 GMT
> Etag: "d41d8cd98f00b204e9800998ecf8427e", "4a00e1-3ddf-4a1816f7a9400"
> Cache-Control: max-age=86400
> P3P: CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"
> Last-Modified: Fri, 22 Apr 2011 13:00:00 GMT
> Content-Type: image/jpeg;charset=utf-8
> Content-Length: 15839
> Date: Sat, 23 Apr 2011 12:07:39 GMT
> X-Varnish: 2113947582 2113947501
> Age: 58
> Via: 1.1 varnish
> Connection: keep-alive
> 
> 
> 
> 
> version
> ======
> varnish 2.1.5
> 
> 
> 
> Log transcript of a single request+response (varnishlog)
> =================================
>    11 SessionOpen  c X.X.X.220 50540 :80
>    11 ReqStart     c X.X.X.220 50540 2113947582
>    11 RxRequest    c GET
>    11 RxURL        c /dam/asset/download/uuid/121a8df4-4fe8-11e0-bd65-56167b3dc56d/variant/103/
>    11 RxProtocol   c HTTP/1.1
>    11 RxHeader     c Host: X.X.X
>    11 RxHeader     c User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0) Gecko/20100101 Firefox/4.0
>    11 RxHeader     c Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
>    11 RxHeader     c Accept-Language: nl,en-us;q=0.7,en;q=0.3
>    11 RxHeader     c Accept-Encoding: gzip, deflate
>    11 RxHeader     c Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
>    11 RxHeader     c Keep-Alive: 115
>    11 RxHeader     c Connection: keep-alive
>    11 RxHeader     c Cookie: __utma=1.1741069999.1296235686.1303504321.1303507491.8; __utmz=1.1303507491.8.8.utmcsr=senzio.com|utmccn=(referral)|utmcmd=referral|utmcct=/; __utma=142895841.963436971.1296236932.1302872710.1303499754.14; __utmz=142895841.1296236932.1.1.utmcsr=(d
>    11 RxHeader     c If-Modified-Since: Fri, 22 Apr 2011 13:00:00 GMT
>    11 RxHeader     c If-None-Match: "d41d8cd98f00b204e9800998ecf8427e", "4a00e1-3ddf-4a1816f7a9400"
>    11 RxHeader     c Cache-Control: max-age=0
>    11 VCL_call     c recv
>    11 VCL_return   c lookup
>    11 VCL_call     c hash
>    11 VCL_return   c hash
>    11 Hit          c 2113947501
>    11 VCL_call     c hit
>    11 LostHeader   c X-Cache:
>    11 VCL_return   c deliver
>    11 VCL_call     c deliver
>    11 VCL_return   c deliver
>    11 TxProtocol   c HTTP/1.1
>    11 TxStatus     c 200
>    11 TxResponse   c OK
>    11 TxHeader     c Server: Apache/2.2.14 (Ubuntu)
>    11 TxHeader     c Content-Disposition: inline; filename="Seminar Speakers.jpg"
>    11 TxHeader     c Expires: Sat, 23 Apr 2011 13:00:00 GMT
>    11 TxHeader     c ETag: "d41d8cd98f00b204e9800998ecf8427e"
>    11 TxHeader     c Cache-Control: max-age=86400
>    11 TxHeader     c P3P: CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"
>    11 TxHeader     c Last-Modified: Fri, 22 Apr 2011 13:00:00 GMT
>    11 TxHeader     c ETag: "4a00e1-3ddf-4a1816f7a9400"
>    11 TxHeader     c Content-Type: image/jpeg;charset=utf-8
>    11 TxHeader     c Content-Length: 15839
>    11 TxHeader     c Date: Sat, 23 Apr 2011 12:07:39 GMT
>    11 TxHeader     c X-Varnish: 2113947582 2113947501
>    11 TxHeader     c Age: 58
>    11 TxHeader     c Via: 1.1 varnish
>    11 TxHeader     c Connection: keep-alive
>    11 Length       c 15839
>    11 ReqEnd       c 2113947582 1303560459.219877005 1303560459.317925930 0.000497818 0.000181675 0.097867250
>    11 Debug        c "herding"
>     0 ExpKill      - 2113947483 -30
>     0 CLI          - Rd ping
>     0 CLI          - Wr 200 19 PONG 1303560459 1.0
> 
> 
> Regards,
> Harm Verhagen
> _______________________________________________
> varnish-dev mailing list
> varnish-dev at varnish-cache.org
> http://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev

--
Mark Nottingham       mnot at yahoo-inc.com






More information about the varnish-dev mailing list