Search This Blog

Saturday, March 8, 2008

Patching Squid to support gzip/deflate encoding

Squid is a caching proxy for the Web supporting HTTP, HTTPS, FTP, and more. It reduces bandwidth and improves response times by caching and reusing frequently-requested web pages. Squid has extensive access controls and makes a great server accelerator.
Unfortunately, Squid is HTTP/1.0 due to the lack of certain features and the main disadvantage, from my point of view, is a lack of gzip/deflate content encoding.
There is a patch created by Swell Technology and committed to the HEAD. But it was not tested and little bit outdated.
So I've spent around six late night/early morning hours to merge the patch to Squid 3.0-Stable1. Right now patched squid it running on the old AMD Athlon64 3000+ machine serving around 500 simultaneously connected clients through the dial-up lines. The main concern was the CPU utilization, but FreeBSD team made an excellent work in regards of the performance in FreeBSD 7.
So here is the snapshot from top:
56897 squid 1 4 0 1085M 1044M kqread 9:28 5.18% squid

and uptime is:
1:51PM up 7 days, 10:45, 2 users, load averages: 0.01, 0.06, 0.15


The FreeBSD port patch is here.

Enjoy.
UPDATE:

Link to FreeBSD PR

UPDATE 1:
FreeBSD maintainer refused to integrate patch to ports tree:

From:Thomas-Martin Seck
Date:Sat, 8 Mar 2008 15:59:46 +0100
I am sorry, but I am not going to integrate third-party patches into
the Squid ports any more (this includes patchsets that are available from
devel.squid-cache.org). Please work with the Squid developers on
integrating this feature into mainline Squid.

Short rationale: Third party patches are a headache to maintain,
especially when they are no longer maintained (cf ICAP for Squid-2) and
they can be a major source of trouble when they contain bugs that are
then wrongly attributed to bugs in Squid itself. I would therefore like
to keep the port as close to the mainline source as possible to make it
easy for users to get support for it from the Squid developers in case
of problems.