Re: Getting URL in background when cache_miss

From: Robert Collins <robertc@dont-contact.us>
Date: 07 Feb 2003 12:43:46 +1100

On Fri, 2003-02-07 at 12:36, Louis Lau wrote:
> Hi there,
>
> I want to modify squid so that when the client get a cache miss, the squid
> will first display a screen
> telling that the content is not in the cache and ask them to come back
> later, while at the
> same time, squid will try to get the content in its background.

What you are trying to do does not make a lot of sense with HTTP
semantics. Still, I'll try to help you with your coding issue.

1) Work on squid 2.5 or 3.0 . Squid 3.0 is in C++ which should be easier
for your Java background. Certainly 2.3 is old an it's unlikely folk
will take the time to look up what you are doing.

2) in C and C++ the address of structs in memory matters a lot when pass
by reference is used. Thus mem copying from one location to another will
not achieve your goals - you will lose refcount accuracy, and will end
up with dangling pointers. What you need to do is duplicate the entire
composite structure - clientHttpRequest, fwdState, store_client,
MemObjects etc that make up a request. A better approach would be to
start a new internal request to get the object, and then just send an
error to the original one, similar to what fwdFail does.

Rgarding the client fd == -1 thing, a client fd of -1 indicates that
there is no client waiting for data, or that it is an internal request.

Hope that helps,
Rob

-- 
GPG key available at: <http://users.bigpond.net.au/robertc/keys.txt>.

Received on Thu Feb 06 2003 - 18:44:34 MST

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