Re: Content-length 2.3STABLE1 error?

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Sun, 16 Jan 2000 05:56:29 +0100

William R Thomas wrote:

> using server side includes were caching. The nearest I could tell is
> that no pages which failed to set the Content-length header were
> getting cached. All documents on the server I wish to accelerate set
> Expires and Cache-control headers.

Seems to work fine here.. but then my Squid-2.3 source trees are all
slightly patched.. but I am not aware of having patched this, only a
problem with persistent connections and IMS queries.

> Additionally I noticed once I got 2.2STABLE5 working that Squid does
> not add a Content-length header to documents which don't originally
> have one.

No, Squid does not do that. Not yet anyway. You could try the attached
patch (applies to Squid-2.2 as well as Squid-2.3).

--
Henrik Nordstrom
Squid hacker

* squid-2.3.STABLE1.add_content_length.patch *

Sun Jan 16 05:52:06 CET 2000
Modified Files in squid/src
        client_side.c

Add a Content-Length header on cache hits if none is present

Index: squid/src/client_side.c
diff -u squid/src/client_side.c:1.1.1.47.6.6 squid/src/client_side.c:1.1.1.47.6.7
--- squid/src/client_side.c:1.1.1.47.6.6 Sun Jan 16 04:01:57 2000
+++ squid/src/client_side.c Sun Jan 16 05:52:04 2000
@@ -1173,6 +1173,10 @@
         httpHeaderDelById(hdr, HDR_CONNECTION);
         stringClean(&strConnection);
     }
+ /* Construct a Content-Length header if none is present */
+ if (is_hit && !httpHeaderHas(hdr, HDR_CONTENT_LENGTH)) {
+ httpHeaderPutInt(hdr, HDR_CONTENT_LENGTH, contentLen(http->entry));
+ }
     /* Handle Ranges */
     if (request->range)
         clientBuildRangeHeader(http, rep);
Received on Sat Jan 15 2000 - 22:19:58 MST

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