[squid-users] Incorrect handling of range requests?

From: Paul <paul@dont-contact.us>
Date: Mon, 8 Mar 2004 18:10:54 -0800 (PST)

Squid does not seem to handle range requests correctly
when presented with an invalid range.

My master content server is running apache, its proxy
server is running squid in http acceleration mode, both
running RedHat 9 with all the latest rpm upgrades:

  Squid: squid-2.5.STABLE1-2 (i.e. squid 2.5 + many patches)
  Apache: httpd-2.0.40-21.9 (i.e. apache 2.0.40 + many patches)

The squid server is configured with "range_offset_limit -1 KB".

In the examples below, test.txt is a 10240-byte text file.

On the master, apache handles range requests correctly. For example,
the following HTTP request returns the last 10 bytes of the file:

  Request: Response:
  --------------------------- ----------------------------
  GET /test.txt HTTP/1.0 HTTP/1.1 206 Partial Content
  Range: bytes=10230-10239 ...
                                  last 10 bytes of file

If I try specify an invalid request range, I get a 416 error:

  Request: Response:
  --------------------------- ----------------------------
  GET /test.txt HTTP/1.0 HTTP/1.1 416 Requested Range Not Satisfiable
  Range: bytes=10240-10241 ...

On the proxy server running squid pointing to the same file, I get
the same behaviour as the master apache server when requesting valid
ranges.

  Request: Response:
  --------------------------- ----------------------------
  GET /test.txt HTTP/1.0 HTTP/1.1 206 Partial Content
  Range: bytes=10230-10239 ...
                                  Content-Range: bytes 10230-10239/10240
                                  Content-Length: 10
                                  ...
                                  last 10 bytes of file

BUT when I specify an incorrect range, I get the whole 10240-byte file:

  Request: Response:
  --------------------------- ----------------------------
  GET /test.txt HTTP/1.0 HTTP/1.0 200 OK
  Range: bytes=10240-10241 ...
                                  Content-Length: 10240
                                  ...
                                  contents of entire file

That is, squid never responds with a HTTP 416 (Invalid Range) error.
In fact in the squid 2.5 source, HTTP error code 416 is not even defined
in src/enums.h.

Is this correct behaviour? Thanks for any clarifications.

-- Paul
Received on Mon Mar 08 2004 - 19:10:55 MST

This archive was generated by hypermail pre-2.1.9 : Thu Apr 01 2004 - 12:00:01 MST