[Varnish] #789: v2.1.3 w/ http_range_support on strips Content-Range on pass

Varnish varnish-bugs at varnish-cache.org
Mon Oct 4 23:01:38 CEST 2010


#789: v2.1.3 w/ http_range_support on strips Content-Range on pass
------------------------------------------------------------------+---------
 Reporter:  jim.robinson                                          |        Type:  defect
   Status:  new                                                   |    Priority:  normal
Milestone:                                                        |   Component:  build 
  Version:  2.1.3                                                 |    Severity:  normal
 Keywords:  http_range_support byte range content-range stripped  |  
------------------------------------------------------------------+---------
 Varnish 2.1.3 with http_range_support on strips the backend Content-Range
 on "pass"

 The HTTP 1.1 specification, section "10.2.7 206 Partial Content" states in
 part that

 {{{
  The response MUST include the following header fields:

       - Either a Content-Range header field (section 14.16) indicating
         the range included with this response, or a multipart/byteranges
         Content-Type including Content-Range fields for each part. If a
         Content-Length header field is present in the response, its
         value MUST match the actual number of OCTETs transmitted in the
         message-body.
 }}}

 While newer version of Apache, in the 2.x series, appear to return
 Content-Type, older versions, in the 1.3.x series, appear to use Content-
 Range.

 Given the VCL:

 {{{
 backend default {
         .host = "127.0.0.1";
         .port = "80";
 }

 sub vcl_recv {
         if (req.http.X-Test ~ "pass") {
                 return (pass);
         }
         if (req.http.X-Test ~ "pipe") {
                 return (pipe);
         }
         return (lookup);
 }
 }}}

 Where 127.0.0.1:80 is an Apache *1.3* server, a Byte Range request is
 handled by returning a Content-Range header instead of using a
 multipart/bytes Content-Type.

 {{{
 $ curl -s -i -HX-Test:pass -HRange:bytes=1-1 http://localhost/test.mp3;
 echo
 HTTP/1.1 206 Partial Content
 Date: Mon, 04 Oct 2010 20:43:38 GMT
 Server: Apache/1.3.26 (Unix) DAV/1.0.3 ApacheJServ/1.1.2
 Last-Modified: Tue, 14 Sep 2010 21:35:06 GMT
 ETag: "1a8fe2-1361723-4c8fea8a"
 Accept-Ranges: bytes
 Content-Length: 1
 Content-Range: bytes 1-1/20322083
 Connection: close
 Content-Type: audio/mpeg

 D
 }}}

 When going through varnish, the "pass" operation filters out Content-
 Range:

 {{{
 $ curl -s -i -HX-Test:pass -HRange:bytes=1-1
 http://localhost:4040/test.mp3; echo
 HTTP/1.1 206 Partial Content
 Server: Apache/1.3.26 (Unix) DAV/1.0.3 ApacheJServ/1.1.2
 Last-Modified: Tue, 14 Sep 2010 21:35:06 GMT
 ETag: "1a8fe2-1361723-4c8fea8a"
 Content-Type: audio/mpeg
 Content-Length: 1
 Accept-Ranges: bytes
 Date: Mon, 04 Oct 2010 20:44:31 GMT
 X-Varnish: 2073488282
 Age: 0
 Via: 1.1 varnish
 Connection: keep-alive

 D
 }}}

 While "pipe" and "lookup" do not:

 {{{
 $ curl -s -i -HX-Test:pipe -HRange:bytes=1-1
 http://localhost:4040/test.mp3; echo
 HTTP/1.1 206 Partial Content
 Date: Mon, 04 Oct 2010 20:44:58 GMT
 Server: Apache/1.3.26 (Unix) DAV/1.0.3 ApacheJServ/1.1.2
 Last-Modified: Tue, 14 Sep 2010 21:35:06 GMT
 ETag: "1a8fe2-1361723-4c8fea8a"
 Accept-Ranges: bytes
 Content-Length: 1
 Content-Range: bytes 1-1/20322083
 Connection: close
 Content-Type: audio/mpeg

 D

 $ curl -s -i -HX-Test:lookup -HRange:bytes=1-1
 http://localhost:4040/test.mp3; echo
 HTTP/1.1 206 Partial Content
 Server: Apache/1.3.26 (Unix) DAV/1.0.3 ApacheJServ/1.1.2
 Last-Modified: Tue, 14 Sep 2010 21:35:06 GMT
 ETag: "1a8fe2-1361723-4c8fea8a"
 Content-Type: audio/mpeg
 Accept-Ranges: bytes
 Date: Mon, 04 Oct 2010 20:45:09 GMT
 X-Varnish: 2073488284
 Age: 7
 Via: 1.1 varnish
 Connection: keep-alive
 Content-Range: bytes 1-1/20322083
 Content-Length: 1

 D
 }}}

 Here's the varnishlog dump from the faulty "pass" request:

 {{{
    10 SessionOpen  c 127.0.0.1 50307 localhost:4040
    10 ReqStart     c 127.0.0.1 50307 2073488290
    10 RxRequest    c GET
    10 RxURL        c /test.mp3
    10 RxProtocol   c HTTP/1.1
    10 RxHeader     c User-Agent: curl/7.19.4 (i386-apple-darwin9.6.2)
 libcurl/7.19.4 zlib/1.2.5
    10 RxHeader     c Host: localhost:4040
    10 RxHeader     c Accept: */*
    10 RxHeader     c X-Test:pass
    10 RxHeader     c Range:bytes=1-1
    10 VCL_call     c recv
    10 VCL_return   c pass
    10 VCL_call     c hash
    10 VCL_return   c hash
    10 VCL_call     c pass
    10 VCL_return   c pass
    11 BackendOpen  b default 127.0.0.1 50308 171.67.112.155 80
    10 Backend      c 11 default default
    11 TxRequest    b GET
    11 TxURL        b /test.mp3
    11 TxProtocol   b HTTP/1.1
    11 TxHeader     b User-Agent: curl/7.19.4 (i386-apple-darwin9.6.2)
 libcurl/7.19.4 zlib/1.2.5
    11 TxHeader     b Host: localhost:4040
    11 TxHeader     b Accept: */*
    11 TxHeader     b X-Test:pass
    11 TxHeader     b Range:bytes=1-1
    11 TxHeader     b X-Varnish: 2073488290
    11 RxProtocol   b HTTP/1.1
    11 RxStatus     b 206
    11 RxResponse   b Partial Content
    11 RxHeader     b Date: Mon, 04 Oct 2010 20:55:59 GMT
    11 RxHeader     b Server: Apache/1.3.26 (Unix) DAV/1.0.3
 ApacheJServ/1.1.2
    11 RxHeader     b Last-Modified: Tue, 14 Sep 2010 21:35:06 GMT
    11 RxHeader     b ETag: "1a8fe2-1361723-4c8fea8a"
    11 RxHeader     b Accept-Ranges: bytes
    11 RxHeader     b Content-Length: 1
    11 RxHeader     b Content-Range: bytes 1-1/20322083
    11 RxHeader     b Connection: close
    11 RxHeader     b Content-Type: audio/mpeg
    10 TTL          c 2073488290 RFC 120 1286225759 0 0 0 0
    10 VCL_call     c fetch
    10 VCL_return   c pass
    10 ObjProtocol  c HTTP/1.1
    10 ObjStatus    c 206
    10 ObjResponse  c Partial Content
    10 ObjHeader    c Date: Mon, 04 Oct 2010 20:55:59 GMT
    10 ObjHeader    c Server: Apache/1.3.26 (Unix) DAV/1.0.3
 ApacheJServ/1.1.2
    10 ObjHeader    c Last-Modified: Tue, 14 Sep 2010 21:35:06 GMT
    10 ObjHeader    c ETag: "1a8fe2-1361723-4c8fea8a"
    10 ObjHeader    c Content-Type: audio/mpeg
    11 Length       b 1
    11 BackendClose b default
    10 VCL_call     c deliver
    10 VCL_return   c deliver
    10 TxProtocol   c HTTP/1.1
    10 TxStatus     c 206
    10 TxResponse   c Partial Content
    10 TxHeader     c Server: Apache/1.3.26 (Unix) DAV/1.0.3
 ApacheJServ/1.1.2
    10 TxHeader     c Last-Modified: Tue, 14 Sep 2010 21:35:06 GMT
    10 TxHeader     c ETag: "1a8fe2-1361723-4c8fea8a"
    10 TxHeader     c Content-Type: audio/mpeg
    10 TxHeader     c Content-Length: 1
    10 TxHeader     c Accept-Ranges: bytes
    10 TxHeader     c Date: Mon, 04 Oct 2010 20:55:59 GMT
    10 TxHeader     c X-Varnish: 2073488290
    10 TxHeader     c Age: 0
    10 TxHeader     c Via: 1.1 varnish
    10 TxHeader     c Connection: keep-alive
    10 Length       c 1
    10 ReqEnd       c 2073488290 1286225759.180437088 1286225759.250189066
 0.000094175 0.069691896 0.000060081
    10 SessionClose c EOF
    10 StatSess     c 127.0.0.1 50307 0 1 1 0 1 1 346 1
 }}}

 I had sent an original query about this to varnish-misc, it discusses
 the real scenario we were having trouble with:

 [http://lists.varnish-cache.org/pipermail/varnish-
 misc/2010-September/004687.html]

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




More information about the varnish-bugs mailing list