Re: Squid Restarted for method Trace with Entity body.

From: Senthil Kumar .R <serengar@dont-contact.us>
Date: Tue, 28 May 2002 12:30:03 +0530

Hi Henrik,

Here is the code for diff -u

diff -u http.c http.ctracefix
--- http.c Thu May 9 14:43:51 2002
+++ http.ctracefix Thu May 23 08:55:10 2002
@@ -1,6 +1,6 @@

 /*
- * $Id: http.c,v 1.371.2.1 2001/01/12 00:51:49 wessels Exp $
+ * $Id: http.c,v 1.371.2.2 2001/07/11 22:58:20 wessels Exp $
  *
  * DEBUG: section 11 Hypertext Transfer Protocol (HTTP)
  * AUTHOR: Harvest Derived
@@ -516,6 +516,7 @@
        } else if (entry->mem_obj->inmem_hi == 0) {
            ErrorState *err;
            err = errorCon(ERR_READ_ERROR, HTTP_INTERNAL_SERVER_ERROR);
+ err->request = requestLink((request_t *) request);
            err->xerrno = errno;
            fwdFail(httpState->fwd, err);
            comm_close(fd);
@@ -526,6 +527,7 @@
        ErrorState *err;
        err = errorCon(ERR_ZERO_SIZE_OBJECT, HTTP_SERVICE_UNAVAILABLE);
        err->xerrno = errno;
+ err->request = requestLink((request_t *) request);
        fwdFail(httpState->fwd, err);
        httpState->eof = 1;
        comm_close(fd);
@@ -737,7 +739,11 @@
            break;
        default:
            /* pass on all other header fields */
+ if ( orig_request->method != METHOD_TRACE)
            httpHeaderAddEntry(hdr_out, httpHeaderEntryClone(e));
+ else
+ continue ;
+
        }
     }

@@ -855,7 +861,7 @@

     debug(11, 5) ("httpSendRequest: FD %d: httpState %p.\n", httpState->fd,
httpState);

- if (httpState->orig_request->content_length > 0)
+ if ((httpState->orig_request->content_length > 0) && (req->method ==
METHOD_POST))
        sendHeaderDone = httpSendRequestEntry;
     else
        sendHeaderDone = httpSendComplete;
[root@serengar-pc src]#

Sorry for the late response.

regards
senthil

Henrik Nordstrom wrote:

> Can you please make that a "diff -u" (much easier to read).
>
> Senthil Kumar .R wrote:
> > Hi ,
> >
> > The squid got restarted, When TRACE with Entity body is given as
> > request.
> >
> > Note :- This is Negative Test condition.
> >
> >
> > Here is the cache.log :-
> >
> >
> > httpSendRequest: FD 18:
> > TRACE / HTTP/1.0
> > Content-Length: 10
> > Via: 1.0 serengar-pc:3128 (Squid/2.4.STABLE1)
> > X-Forwarded-For: 127.0.0.1
> > Host: 192.168.100.253
> > Cache-Control: max-age=259200
> > Connection: keep-alive
> >
> >
> > 2002/05/23 09:19:23| comm_write: FD 18: sz 194: hndl 0x807178c: data
> > 0x8306400.
> > 2002/05/23 09:19:23| cbdataLock: 0x8306400
> > 2002/05/23 09:19:23| commSetSelect: FD 18 type 2
> > 2002/05/23 09:19:23| cbdataUnlock: 0x8306738
> > 2002/05/23 09:19:23| comm_poll: 1 FDs ready
> > 2002/05/23 09:19:23| comm_poll: FD 18 ready for writing
> > 2002/05/23 09:19:23| commHandleWrite: FD 18: off 0, sz 194.
> > 2002/05/23 09:19:23| commHandleWrite: write() returns 194
> > 2002/05/23 09:19:23| cbdataValid: 0x8306400
> > 2002/05/23 09:19:23| httpSendRequestEntry: FD 18: size 194: errflag 0.
> > 2002/05/23 09:19:23| pumpStart: FD 18, key
> > 90C37A89F2705CC829420F904F2E49F9
> > 2002/05/23 09:19:23| assertion failed: pump.c:107: "p != NULL"
> >
> >
> >
> >
> > RFC states,
> >
> > 4.3
> >
> > The presence of a message-body in a request is signaled by the
> > inclusion of a Content-Length or Transfer-Encoding header field in
> > the request's message-headers. A message-body MUST NOT be included
> > in
> > a request if the specification of the request method (section
> > 5.1.1)
> > does not allow sending an entity-body in requests. A server SHOULD
> > read and forward a message-body on any request; if the request
> > method
> > does not include defined semantics for an entity-body, then the
> > message-body SHOULD be ignored when handling the request.
> >
> >
> > So Squid SHOULD ignore it.
> >
> >
> > We have fixed this ,
> >
> > it will ignore the Entity-body and process the Trace request.
> >
> >
> >
> > Fix work:-
> >
> > diff http.c http.ctracefix
> > 3c3
> > < * $Id: http.c,v 1.371.2.1 2001/01/12 00:51:49 wessels Exp $
> > ---
> >
> > > * $Id: http.c,v 1.371.2.2 2001/07/11 22:58:20 wessels Exp $
> >
> > 518a519
> >
> > > err->request = requestLink((request_t *) request);
> >
> > 528a530
> >
> > > err->request = requestLink((request_t *) request);
> >
> > 739a742
> >
> > > if ( orig_request->method != METHOD_TRACE)
> >
> > 740a744,746
> >
> > > else
> > > continue ;
> >
> > 858c864
> > < if (httpState->orig_request->content_length > 0)
> > ---
> >
> > > if ((httpState->orig_request->content_length > 0) && (req->method
> >
> > == METHOD_POST))
> >
> >
> > Please Revert back your comments.
> >
> >
> > regards
> > senthil

--
Visit us :-
http://cdn.hcltech.com
Received on Tue May 28 2002 - 01:02:44 MDT

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