Re: Squid Restarted for method Trace with Entity body.

From: Senthil Kumar .R <serengar@dont-contact.us>
Date: Fri, 07 Jun 2002 12:56:56 +0530

Hi Henrik ,

   Thanks for your response. I understood the some other methods also uses
Entity-body. I have fixed that too and tested . It is working fine .
I will check the Squid-2.5 and later release .

I have fixed only in two places :-

Here I am skiping the headers from the End-user for trace Request to the
Orginn Server.

          if ( orig_request->method != METHOD_TRACE)
            httpHeaderAddEntry(hdr_out, httpHeaderEntryClone(e));
          else
                  continue ;
         }

Here is the correct one , Now this will handle for the methods which has
Entity body.

 if (httpState->orig_request->content_length > 0)
    if ((httpState->orig_request->content_length > 0) && (req->method !=
METHOD_TRACE))
         sendHeaderDone = httpSendRequestEntry;
      else
         sendHeaderDone = httpSendComplete;

I have Tested PUT and POST.

For OPTIONS the Entity body is optional.

Thanks
senthil

Henrik Nordstrom wrote:

> Should have been a bit clearer in my response.. see below.
>
> Senthil Kumar .R wrote:
> > 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
> > @@ -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);
>
> The above is already fixed in the current sources (including Squid-2.4).
>
> > @@ -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);
>
> This too..
>
> > @@ -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 ;
> > +
> > }
> > }
>
> This do not look correct. Why do you not want Squid to forward headers it do
> not know about in TRACE requests?
>
> > @@ -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;
>
> And this is most certainly NOT correct as there is numerous request methods
> that may have a request entity, not only POST. The most obvious one is PUT,
> but the truth is that nearly any request method can have a request entity.
>
> Regards
> Henrik

--
Visit us :-
http://cdn.hcltech.com
Received on Fri Jun 07 2002 - 01:24:38 MDT

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