Giving back to squid: range_offset_limit mod

I realized that if we ever want to be able to cache vista updates, we’re going to need range_offset_limit set to -1.  Why it wants to download so many byteranges, I have no idea.  The problem is that squid just eats our bandwidth with that option turned on, because it’s global.  Recently I’ve contacted the squid developers and offered to (attempt to) add the ability to set range_offset_limit per a pattern.  My idea was to change the current syntax:

range_offset_limit (bytes)

To the following:

range_offset_limit (bytes) [-i] [pattern]

So that “-i” is a flag to make the pattern case insensitive and “pattern” is the pattern to match by.  I’m sort of patterning the code after the refresh_pattern code, as it is very similar in function.  Like the refresh_pattern rules, I’m maintaining the list of range_offset_limit rules in a linked list, in the order in which they appear in the config file.  Each time a check is made to see if a range request exceeds range_offset_limit, it will iterate through the list from top to bottom looking for a match.  As soon as a match is found, it will stop and return the appropriate value.  If none is found, it will return the default limit of 0.  In this way, the range_offset_limit rules will work just like acls or iptables rules.

At least, that’s what’s supposed to happen.  😉  We’ll see.  I’m making the modifications to the 3.x branch, so I’ll have to make sure I’m careful to get that running right on our server to test it.  The Ubuntu repos are still serving up the 2.7 branch, so I’ve got to make sure I get the init scripts right and such.  I figure I can still use the old one, though.  I’ve already modified the Ubuntu-supplied squid init script so I can point it to a copy of squid installed anywhere on the disk.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: