[PATCH] Cache-Control overwriting hack

From: Chris Woodfield <rekoil_at_semihuman.com>
Date: Mon, 4 May 2009 12:52:11 -0400

Hi,

This is a patch of probably limited utility, but I'll send it out
anyway and leave it for you folks to decide :) It was written against
2.7STABLE6 but patches cleanly into HEAD.

The purpose of this patch is to support the use of an "alternate"
Cache-Control header in reverse-proxy environments. The patch consists
of a new config directive, replace_client_cc, and code in
client_side.c that is called if that config option is enabled.

The new code then looks for the existence of a header titled "Client-
Cache-Control" which should contain syntax similar to that of a normal
Cache-Control header. When present, Squid will delete the existing
Cache-Control header if it exists, replace it with the contents of
Client-Cache-Control, then delete the Client-Cache-Control header.

So, the end result is that you have one Cache-Control header that
squid pays attention to, and then a completely different one that
client browsers will see.

A couple TODOs on this if folks agree it's worthwhile:

1. Change the config option to a named header, eliminating the need to
hard-code Client-Cache-Control (at the cost of using
httpHeaderFindByName() instead of httpHeaderGetList() which seems much
more costly CPU-wise).

2. Allow for some method by which the original Cache-Control header
can be preserved for diag purposes (maybe add in as X-Original-Cache-
Control?)

Feedback appreciated, etc...

-C

Received on Mon May 04 2009 - 16:52:16 MDT

This archive was generated by hypermail 2.2.0 : Tue May 05 2009 - 12:00:02 MDT