saving http body (content) :: SQUID:2.6STABLE10

From: ccmail111 <ccmail111@dont-contact.us>
Date: Tue, 6 Mar 2007 18:06:20 -0800 (PST)

Hi,

I am trying to save http body (content) that is
replied by server in response to HTTP client request
from a client.
I am using SQUID2.6 on x86/Linux.

I modified: http.c as below:

static void
httpAppendBody(HttpStateData * httpState, const char
*buf, ssize_t len, int buffer_filled)
{
    StoreEntry *entry = httpState->entry;
    const request_t *request = httpState->request;
    const request_t *orig_request =
httpState->orig_request;
    struct in_addr *client_addr = NULL;
    u_short client_port = 0;
    int fd = httpState->fd;
    int complete = httpState->eof;
    int keep_alive = !httpState->eof;
    while (len > 0) {
        if (httpState->chunk_size > 0) {
            size_t size = len;
            if (size > httpState->chunk_size)
                size = httpState->chunk_size;
            httpState->chunk_size -= size;
            storeAppend(httpState->entry, buf, size);
// TEST START
                {
                size_t rc = 0;
                        printf("TEST: write ... \n");
                if (entry->fd) {
                        rc = fwrite(buf, sizeof(char),
len, entry->fd);
                if (rc <= 0)
                        printf("TEST: write error:
rc=%d \n", rc);
                }
                }
// TEST END

            buf += size;
            len -= size;
        } else if (httpState->chunk_size < 0) {
            /* non-chunked without content-length */
            storeAppend(httpState->entry, buf, len);
// TEST START
                {
                size_t rc = 0;
                        printf("TEST: write ... \n");
                if (entry->fd) {
                        rc = fwrite(buf, sizeof(char),
len, entry->fd);
                if (rc <= 0)
                        printf("TEST: write error:
rc=%d \n", rc);
                }
                }
// TEST END
            len = 0;

Assumption: 'entry->fd' is uniquely created in
store.c: storeCreateEntry(..)

The above does not seem to work.
For example www.yahoo.com page has 10 gifs,
I donot see the gif files (content).

Any suggestions on how to save the content in ver 2.6
?
Feedback is highly appreciated !

Thanks,

MC

 
____________________________________________________________________________________
Never miss an email again!
Yahoo! Toolbar alerts you the instant new Mail arrives.
http://tools.search.yahoo.com/toolbar/features/mail/
Received on Tue Mar 06 2007 - 19:06:45 MST

This archive was generated by hypermail pre-2.1.9 : Sun Apr 01 2007 - 12:00:01 MDT