Getting URL in background when cache_miss

From: Louis Lau <louis_lau@dont-contact.us>
Date: Fri, 7 Feb 2003 09:36:16 +0800

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.

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 Thu Feb 06 2003 - 18:36:04 MST

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