reset by peer messages - httpTryRestart

From: Oskar Pearson <oskar@dont-contact.us>
Date: Mon, 22 Jun 1998 02:46:13 +0200

--MimeMultipartBoundary
Content-Type: text/plain; charset=us-ascii

Hi

I am trying to hack the code so that servers that send connection-reset
by peer messages (just after sending the headers in reply) are re-tried.

Squid-1.2b22, http.c - httpReadReply:

        if (httpTryRestart(httpState)) {
            httpRestart(httpState);

Looking at the code for these two functions you wil see that
httpTryRestart says:

     * We only retry the request if it looks like it was
     * on a persistent/pipelined connection

Now in my case I am probably not trying to restart a persistent connection.
Most things do this immediately on the request being sent. I added
debug statements to http.c:

---------
        if (errno == ECONNRESET) {

        /*
         * Check if the headers have been sent in their entirity.
         * This is normally the case since the servers in question
         * send the headers, a blank line and then a reset
         */
        debug(50, 0) ("RESET - before httpProcessReplyHeader: httpState->reply_hdr is %p, reply_hdr_state is %d, entry->mem_obj->inmem_hi is %d, object_sz is %d\n",httpState->reply_hdr,httpState->reply_hdr_state,entry->mem_obj->inmem_hi,entry->mem_obj->object_sz);
        httpState->eof = 1;
        /* I wanted to try and find if the connection was closed before the
         * actual headers were sent, during or afterwards
         */
        if (httpState->reply_hdr_state < 2)
                httpProcessReplyHeader(httpState, buf, len);
        debug(50, 0) ("RESET: httpState->reply_hdr is %p, reply_hdr_state is %d\n",httpState->reply_hdr,httpState->reply_hdr_state);
        }
---------

I also hacked the errpage.c file so that I would get a printout of all the
URLs that returned this message.

1998/06/22 00:06:22| RESET - before httpProcessReplyHeader: httpState->reply_hdr is (nil), reply_hdr_state is 0, entry->mem_obj->inmem_hi is 0, object_sz is -1
1998/06/22 00:06:22| RESET: httpState->reply_hdr is 0xa3e6738, reply_hdr_state is 2
1998/06/22 00:06:22| Hey, Oskar! I got an error on site http://www.startrek.com/flash/BRF/BRFconsoleBtn.swf - errno = 104 (Connection reset by peer)

I thus have two questions:

1) From what I can see the user PC would not have actually received any
        data at this point, right? We can't re-start the request if the
        client has been passed headers, since the headers could be different
        the second time round (cookies, right?).

        No data is passed on to the client until all headers have been received,
        right? If so, I can't see where this happens :(

2) Is there a built-in function to re-try the connection (that deallocates
        everything except the client side of the connection, checks that
        no headers have been sent, etc etc).

        commRetryConnect seems to sort of do what I want, but it functions
        at a much lower level..

Thanks for any help or assistance.

Oskar

---
"Haven't slept at all. I don't see why people insist on sleeping. You feel
so much better if you don't. And how can anyone want to lose a minute -
a single minute of being alive?"				-- Think Twice
--MimeMultipartBoundary--
Received on Tue Jul 29 2003 - 13:15:51 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:11:49 MST