Can't see the content of HttpBody

From: EliG <grois_at_zahav.net.il>
Date: Tue, 21 Jul 2009 03:51:36 -0700 (PDT)

Hi Guys,

I am making my firts steps in Squid... and trying to see the content of the
Html Response.
In a future I will try to modify that content. The following code only shows
me the content of the header but no content for the body. Please help.

in clientStream.cc:
~~~~~~~~~~~~~~
...
void
clientStreamCallback(clientStreamNode * thisObject, ClientHttpRequest *
http,
                     HttpReply * rep, StoreIOBuffer replyBuffer)
{
    clientStreamNode *next;
    assert(thisObject && http && thisObject->node.next);
    next = thisObject->next();

    debugs(87, 3, "clientStreamCallback: Calling " << next->callback << "
with cbdata " <<
           next->data.getRaw() << " from node " << thisObject);
    //MY CODE STARTS HERE
    if (rep)
    {
            if (rep->content_type.pos("text/html"))
            {
                    MemBuf *buf = rep->pack();
                    debugs(87, 1, "My Code!!! The Header is: " << buf->content());

                    Packer p;
                    MemBuf mb;
                    mb.init();
                    const HttpBody b = rep->body;
                    httpBodyPackInto(&b, &p);
                    packerToMemInit(&p, &mb);

                    debugs(87,1, "My Code!!! The Body is : " << mb.content());
                          packerClean(&p);
                          mb.clean();
            }
    }
    //MY CODE ENDS HERE

    next->callback(next, http, rep, replyBuffer);
}

-- 
View this message in context: http://www.nabble.com/Can%27t-see-the-content-of-HttpBody-tp24585532p24585532.html
Sent from the Squid - Development mailing list archive at Nabble.com.
Received on Tue Jul 21 2009 - 10:51:41 MDT

This archive was generated by hypermail 2.2.0 : Sat Jul 25 2009 - 12:00:08 MDT