Re: [squid-users] Squid modification help

From: Louis Lau <louis_lau@dont-contact.us>
Date: Thu, 6 Feb 2003 12:43:35 +0800

To be more particular, i want to modify fwdStart() function

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())
    {
        // 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);

        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);
        return;
    }
    // End of modification
    .... // start as normal

}

----- Original Message -----
From: "Louis Lau" <louis_lau@nechk.nec.com.hk>
To: "Jason M. Kusar" <jason@swordofthespirit.org>;
<squid-users@squid-cache.org>
Sent: Thursday, February 06, 2003 12:19 PM
Subject: Re: [squid-users] Squid modification help

>
> ----- Original Message -----
> From: "Jason M. Kusar" <jason@swordofthespirit.org>
> To: "Louis Lau" <louis_lau@nechk.nec.com.hk>;
<squid-users@squid-cache.org>
> Sent: Thursday, February 06, 2003 11:55 AM
> Subject: Re: [squid-users] Squid modification help
>
>
> > First of all, have you looked at the programmers guide on the website?
> It's
> > a liitle out of date I believe, but it shows the process a request
takes.
> >
> Yep. But i am still digesting it and i am pretty fresh in linux
programming.
> I have looked
> at the part about process a request takes. It seems that a request is
being
> answered by the
> storemanager. When i follow the code, there are just too many data
structure
> and process to
> trace, i get lost by looking back and forth of the code in different file.
> It would be more helpful
> in the programming guide if it can tells what tools we can used to
> manupulate the structure used in each module and functions.
>
> > Second, unless you're using a 14.4K modem as your connection, squid can
> > probably have the content by the time the user sees any message telling
> them
> > that the content is being fetched. Also, unless your talking large
files,
> I
> > don't think there would be much point to reporting the status of a fetch
> to
> > the client. Or are you talking about just using squid to cache large
> files
> > say from an ftp site?
> >
> Yep, close guess. As we want to put the squid server in china, the network
> in
> china is very slow when the requested content is in foreign country. The
> speed can be as
> slow as a 14.4K modem. (Downloading a red hat disc can take 1 day...) Of
> course we are not
> trying to cache large files like the image of red hat. But i want to tell
> the user to surf other page
> first while we are getting page from a foreign country and then we can
share
> the cache to other
> user that may hit this foreign page later.
>
> > Perhaps a little more info would help.
> >
> > Cheers,
> > --Jason
> >
> > ----- Original Message -----
> > From: "Louis Lau" <louis_lau@nechk.nec.com.hk>
> > To: <squid-users@squid-cache.org>
> > Sent: Wednesday, February 05, 2003 10:07 PM
> > Subject: [squid-users] Squid modification help
> >
> >
> > > Hi all,
> > >
> > > I wonder if anyone can give me hints in completing my assignment.
> > >
> > > In my assignment i need to accomplish the following:
> > >
> > > 1. I want to configure/modify squid such that when there is a cache =
> > > miss, the squid server should reply to the client that we are trying
to
> =
> > > get the content for the user now. The squid server will then try to
get
> =
> > > the content for the user in background so that next time (after some =
> > > minute i suppose), the content should be found in the cache.
> > >
> > > 2. If the user desperately need to get the cache-missed content =
> > > immediately, he/she can 'clt refresh' in the broswer and request the =
> > > most updated content from the cache. The squid will then check the
http
> =
> > > request header 'if-modified-since' header and if it request the most =
> > > update, the cache will by-pass the scenario 1 mentioned above and =
> > > retrieve the content for client immediately. Even better is when i can
=
> > > show the status of the retrieve if possible while the user is waiting
=
> > > for the content.. (eg. such as telling the client that we have already
=
> > > retrieved 50% of the content.)
> > >
> > > I have read some of the source code of squid now.. i am thinking of =
> > > modifiying the forward.c module in squid 2.3. As it seems that squid
2.3
> =
> > > seems to be simplier to modify. And i have touched some code in =
> > > client_side.c too.. yet, it seems not working very well at the moment,
=
> > > are there any module that i should have changed in order to finish my
=
> > > assignment?=20
> > > I want to know the internal architecture used in squid. It is quite =
> > > trouble to trace the function call in squid to see how squid works in
=
> > > the code level.
> > >
> > > Thanks for any input that maybe suggested by you guys/gals.=20
> > >
> > > Best regards,
> > >
> > > Louis Lau
> > >
> > >
> >
>
Received on Wed Feb 05 2003 - 21:43:54 MST

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