Re: Access to cached object

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Tue, 28 Dec 2004 16:19:50 +0100 (CET)

Please use the squid-dev mailinglist for Squid development questions.

On Mon, 27 Dec 2004, Chua Chee How wrote:

> I would like to ask something on Squid-3. I'm really
> at my wits' end. I simply can't extract the body of
> the reply message.

You need a store client to do what you ask for. Unfortunately this section
of Squid is not fully documented yet.

> If you can still recall, I am trying to add image
> transcoding capability into the Squid code. That's why
> I'm trying to extract the reply body. I need to pass
> the entire body to the transcoding function to change,
> say, the image size.

When is this transcoding to take place? per request, or before the object
enters the cache?

If per request then it is best done using the client streams interface in
Squid-3.0, the same interface used by ESI for modifying responses per the
ESI specifications. The client streams interface is partially documented
in the programmers guide, but how you insert your node in the reply chain
is still undocumented.

If before the object enters the cache then there unfortunately is no good
interface today.

> What I've managed so far is to get the reply size. I
> noted that for bigger sized files, Squid actually
> breaks them up into smaller chunks before sending them
> (I'm guessing this is the implementation of chunked
> transfer encoding?). I also managed to extract the
> smaller pieces of data (i.e. fragments of the original
> reply) from the StoreIOBuffer instances.
>
> Initially I had thought that the HttpReply instance
> associated with a StoreEntry instance holds the body.
> But entry->getReply()->body.mb.buf always returns NULL
> and its size 0. I did look at the MemObj methods and
> from the trace it gave, I can see that the MemObj
> object is filled with the reply message. However, the
> object is also used for other objects as well and it
> seems to be transient, since it's being called
> multiple times.
>
> I've traced the program to a function storeRead()
> which calls sio->read_(). After this call, the data is
> then split up into chunks to be sent to the client. I
> can't find the defintion for this function and thus I
> don't know what is it exactly doing.
>
> And this is it - basically, I'm at a dead-end.
>
> Any help or advise will be deeply appreciated.
>
> Regards,
> Chee How
Received on Tue Dec 28 2004 - 08:19:52 MST

This archive was generated by hypermail pre-2.1.9 : Fri Dec 31 2004 - 12:00:05 MST