Re: squid adding gzip support

From: Robert Collins <robertc@dont-contact.us>
Date: 14 Aug 2003 07:49:39 +1000

On Thu, 2003-08-14 at 08:16, Gonzalo Arana wrote:
> Hi,
>
> I am interested in adding support for Content-Encoding: gzip to squid.
> I had done some patching, and I managed to get squid compressed
> response, but I get corrupted data.
> I would like to ask some questions about squid code in order to solve
> that problem.
> Sample question: size of buffer has to change, since it has compressed
> data, but (in client_sice.c: clientSendMoreData())
> entry->mem_obj->inmem_hi has the size too. How should I modify this?
> May I alter this lvalue directly?

No. You do one of two things:
Intercept the data before the comm_write function, compress it, and
comm_write the new buffer, or
Intercept the data before clientSendMoreData() and compress it there.

You cannot alter arbitrary offsets without throwing a lot of squid out
of whack - including range requests (which in 2.5 will be a cause of
real problems for you).

Please note, that if you have squid adding a CE to a http response, you
MUST follow the RFC2616 notes on non-semantically-transparent proxies.

Offhand that means adding a 214 warning (i.e. Warning: 214
this.proxy.com "Added gzip content-encoding")

Secondly you'll definately want to add a reply based acl for determining
whether to compress.

Lastly, I -urge- you to consider doing this work on squid-3.0. It has a
better framework for performing such transformations. Also, we won't
accept new functionality into squid 2.5 as it's in stable release mode -
so if you want your patches to become part of squid (which is a
different discussion) you'd need to forward port them to 3.x anyway.

Cheers,
Rob

-- 
GPG key available at: <http://members.aardvark.net.au/lifeless/keys.txt>.

Received on Wed Aug 13 2003 - 15:50:06 MDT

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