Re: Squid sends conflicting headers to origin when If-Unmodified-Since header is present from client

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Wed, 12 Jan 2011 15:47:37 +1300

On 12/01/11 11:38, Guy Bashkansky wrote:
> I have to modify the behavior of a customized version of Squid 2.4
> STABLE6 code, either by configuration or by coding. Currently I can
> not switch to any other Squid version, because of the customizations.
>
>
> Problem description:
>
> - When a client sends a byte-range request with an If-Unmodified-Since
> header AND the object in Squid's cache is stale, then this Squid
> version generates a request to origin with both IUMS and IMS headers,
> which is conflicting and undefined by RFC2616. The origin throws an
> error.
>
>
> Proposed solution:
>
> - On an IMS check for a content that was requested with a UIMS header,
> Squid should only insert the IMS header, not the IUMS header. (If
> only the IUMS header was added, then the origin would return origin
> content unnecessarily, since it hasn't changed from the the cached
> version.)
>
> - Once the origin check is complete, then Squid cache should compute
> IUMS calculations as defined in RFC2616, returning possibly a 206
> Partial or 412 precondition failed.
> http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
>
>
> Questions:
>
> - Is there any possibility to facilitate such behavior using Squid 2.4
> STABLE6 configuration?
>
> - If not, then where in the code should I start to look to make the
> necessary code change, and approximately how?
>
> - I could not find any notion of If-Unmodified-Since in the Squid 2.4
> STABLE6 code. What's the best way to handle this?

You will need to:
  * register the header in src/HttpHeader.c and src/enums.h (duplicating
the registration for If-Modified-Since).
  * add the relevant logics to httpBuildRequestHeader() in src/http.c to
consider it when passing o or adding HDR_IF_MODIFIED_SINCE.

Have a good look through the behaviour added by those customizations
anyway. It's highly likely that they are irrelevant in the later
versions. If not, we are interested in merging useful features to avoid
exactly this type of version problem in future.

Amos

-- 
Please be using
   Current Stable Squid 2.7.STABLE9 or 3.1.10
   Beta testers wanted for 3.2.0.4
Received on Wed Jan 12 2011 - 02:47:42 MST

This archive was generated by hypermail 2.2.0 : Wed Jan 12 2011 - 12:00:04 MST