Re: squid cache information - help

From: Alex Rousskov <rousskov@dont-contact.us>
Date: Tue, 13 Feb 2007 16:12:42 -0700

On Tue, 2007-02-13 at 14:54 -0800, ccmail111 wrote:

> Thank you very much for your valuable input.
>
> Question:
> To enable SQUID3.x proxy save the page in file,
> I modified code as follows, but unable get the page.
>
> I did:
>
> File: store_client.cc
> In function:
> static void
> storeClientReadBody(void *data, const char *buf,
> ssize_t len, StoreIOState::Pointer self)
> {
>
> ....
>
> debug(90, 3)("storeClientReadBody: len %d", (int)
> len);
>
> ....
> >>>>> new code start here..
>
> {
> int rc = 0;
> FILE *ffd = 0;
> char fbuf[256];
>
> memset(fbuf, 0, sizeof(fbuf));
> strcpy(fbuf, "/tmp/");
> strcat(fbuf, sc->entry->getMD5Text());
> ffd = fopen(fbuf, "a+");
> if (!ffd) {
> fprintf(stderr,"TEST: file name: %s, ffd: %p,
> rc: (%s), name: %s, len: %d\n",
> fbuf, ffd, strerror(errno),
> sc->entry->getMD5Text(), len);
> }
> rc = fwrite(buf, 1, len, ffd );
> if (rc < 0) {
> fprintf(stderr,"TEST: write rc: %d : %s: ffd:
> %p \n", rc, strerror(errno), ffd);
> }
> fclose(ffd);
> }
> >>>>> new code end here
>
> }

You seem to be writing "buf", which is not used in storeClientReadBody()
and so probably does not contain the content you are after. I am not
sure any buffer in storeClientReadBody contains object body, but I am
not a store API expert.

Also, I do not think this kind of hack will work in general unless you
somehow protect the file from being written to by different transactions
that deal with the same store entry.

Sorry that I cannot be more helpful at this time,

Alex.

> > Here is an example of a thread offering up to four
> > starting points for
> > your question:
> >
> http://thread.gmane.org/gmane.comp.web.squid.devel/4048/
> >
> > This recent thread may also be relevant:
> >
> http://thread.gmane.org/gmane.comp.web.squid.devel/4197/
Received on Tue Feb 13 2007 - 16:13:21 MST

This archive was generated by hypermail pre-2.1.9 : Thu Mar 01 2007 - 12:00:02 MST