Re: Getting URL in background when cache_miss

From: Senthil Kumar.R <serengar@dont-contact.us>
Date: Fri, 07 Feb 2003 16:09:15 +0530

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.

Are you modifying the code, so that Pre-fetching of object occurs in the
background which is transparent to the End-user
while accessing a particular website.

My opinion is

Generate the Internel request to the squid for the url's to prefetch in
backgroud.
This can be done by parsing the reply body content for the url's and by making
an internal request to the squid.

>
> To be more particular, i want to modify fwdStart() function such that
> whenever the squid need to
> go direct to other site, it reply the original connection with an error page
> and continue the retrieval in back ground. This is what i have roughly
> done..
>
> fwdStart(int fd, StoreEntry * e, request_t *r)
> {
> // Begin of fwdStart
>
> // Modification by Louis....
> // Check whether the request content is in forward site
> if(check_foreign()&&check_Modified_Since_Header())
> {
> // Display an error page first
> err = errorCon(ERR_FOREIGN_SITE, HTTP_RETRIEVING); <- add another
> Error type
>
> HTTP_RETRIEVING is
>
> the same as HTTP_UNAVALIABLE
>
> err->request = requestLink(r);
> err->src_addr = r->client_addr;
> errorAppendEntry(e, err);
>
> // fake the squid server by giving a fake fd ...
> <- not sure what this part done indeed... i just copy the rest of
> the process in
> fwdStart() in here.
> storeUrl(e);
> e->mem_obj->request = requestLink(r);
> e->mem_obj->fd = random(); <- fake a fd
> fwdState->entry = e'
> ... blahblahblah... setting up fwdState
> storeLockObject(e);
> EBIT_SET(e->flags, ENTRY_FWD_HDR_WAIT);
> storeRegisterAbort(e, fwdAbort, fwdState);
> peerSelect(r, e, fwdStartComplete, fwdState);
>
> return;
> }
> // End of modification
> .... // start as normal
>
> }
>
> Seems that just faking the fd doesn't work.. actually, can i use fd=-1 in
> the code? what does client fd = -1 implies? and i have try to memcpy the
> request_t r and storeentry e object to another tmp object in the "IF" loop.
> the squid always display the error page and i don't think it did go forward
> in looking for the page in background. Am i going the right direction for
> this or am i modifying the wrong part of code. Thanks for any comment.
>
> cheers,
>
> Louis
Received on Fri Feb 07 2003 - 03:39:45 MST

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