[Varnish] #702: Bad Content-Length when Range support is enabled

Varnish varnish-bugs at varnish-cache.org
Thu May 20 14:19:27 CEST 2010


#702: Bad Content-Length when Range support is enabled
-------------------+--------------------------------------------------------
 Reporter:  luc    |        Type:  defect
   Status:  new    |    Priority:  normal
Milestone:         |   Component:  build 
  Version:  trunk  |    Severity:  normal
 Keywords:         |  
-------------------+--------------------------------------------------------
 Testing varnish 2.1.2

 When the client ask for a range greater than the size of the file, the
 content length is set off by one of the real size, so the client is stuck
 waiting for more data.

 I can reproduce it easily with curl:
 pontis.js size: 10629 bytes
 {{{
 curl -v \
    -H 'Host: s1.s-sfr.fr' \
    -H 'Range: bytes=0-20000'\
    http://93.17.156.118/js/pontis.js
 }}}
 Curl sends:
 {{{
 > GET /js/pontis.js HTTP/1.1
 > User-Agent: curl/7.20.0 (i486-pc-linux-gnu) libcurl/7.20.0
 OpenSSL/0.9.8n zlib/1.2.3.4 libidn/1.15 libssh2/1.2.4
 > Accept: */*
 > Host: s1.s-sfr.fr
 > Range: bytes=10000-20000
 }}}
 Varnish response:
 {{{
 < HTTP/1.1 206 Partial Content
 < Server: Apache/2.2.13 (Fedora)
 < Last-Modified: Mon, 19 Apr 2010 13:15:23 GMT
 < Via: http3
 < Cache-Control: public
 < Expires: Thu, 20 May 2010 12:04:03 GMT
 < Vary: Accept-Encoding
 < Content-Type: text/javascript
 < Accept-Ranges: bytes
 < Date: Thu, 20 May 2010 11:59:24 GMT
 < X-Varnish: 221598756 210156964
 < Age: 3669
 < Via: 1.1 varnish
 < Connection: keep-alive
 < Content-Range: bytes 0-10629/10629
 < Content-Length: 10630
 }}}

 The content-length is clearly incorrect, and the client wait for 10630
 bytes, and varnish only send 10629.

 Others case can be:
 {{{
 curl -v -H 'Host: s1.s-sfr.fr' http://93.17.156.118/js/pontis.js -H
 'Range: bytes=10628-10629'
 < Content-Range: bytes 10628-10629/10629
 < Content-Length: 2
 }}}
 Should be 1

-- 
Ticket URL: <http://varnish-cache.org/ticket/702>
Varnish <http://varnish-cache.org/>
The Varnish HTTP Accelerator




More information about the varnish-bugs mailing list