Ranges: ??s and bug(?).

From: Leeann BENT <lbent@dont-contact.us>
Date: Thu, 8 May 2003 17:54:47 -0700 (PDT)

Hi All -

I have been playing with the Squid's range request handling and I'm not
sure that I understand how range_offset_limit is supposed to work. Here's
my understanding:

range_offset_limit -1 KB => All range requests are fetched from the
                                beginning and cached. Squid serves
                                up the requested range to the client,
                                pulled from the whole object.

range_offset_limit 0 KB => All range requests are passed on as
                                is, with no attempt to cache the
                                objects.

range_offset_limit X KB => Range requests with an offset < X KB are
                                fetched and cached.

I cannot get Squid to work the way I expect, however, with
"range_offset_limit -1 KB", so I suspect I misunderstand what is actually
supposed to be happening. Specifically, when I request bytes 5-500 (for
example) squid passes the requestthrough to the server, even though the
range_offset_limit is set to 1KB.

Also, I'm not sure I understand how this interacts with a suffix
specifier, since at the time of the request there is no way of knowing how
far into the file the suffix is. Should there be a default in this case
(i.e. never cache because a suffix request implies the request is for the
end of the file)?

Finally, I think I have discovered a bug in the way Squid treats multipart
range responses. Since the tempBuffer offset is pulled from the request,
not the response (which has none since the body of the reply is the
multipart response), the multipart response from the server is getting cut
off. I've introduced the following check in my code, but I'm not sure it's
the correct place for the check. I just check if the response contains
ranges before assuming they do:

client_side_reply.cc: Lines 1897-1906 got changed to:

if (next()->readBuffer.offset != 0) {
    if (!rep->content_range) {
        /* Only use the offset if range reply as well. */
        tempBuffer.length = body_size;
        tempBuffer.data = body_buf;
    } else if (next()->readBuffer.offset > body_size) {
        /* Can't use any of the body we recieved. send nothing */
        tempBuffer.length = 0;
        tempBuffer.data = NULL;
    } else {
        tempBuffer.length = body_size - next()->readBuffer.offset;
        tempBuffer.data = body_buf + next()->readBuffer.offset;
    }
} else { ...

Thanks,
Leeann
Received on Thu May 08 2003 - 18:54:52 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:19:52 MST