Re: [PATCH] Compliance: handle HTTP OPTIONS and TRACE requests with asterisk URIs

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Tue, 31 Aug 2010 03:49:26 +0000

On Mon, 30 Aug 2010 19:33:39 -0600, Alex Rousskov
<rousskov_at_measurement-factory.com> wrote:
> Compliance: handle HTTP OPTIONS and TRACE requests with asterisk URIs.
>
> Handle '*' URIs in urlParse(). This allows Squid properly respond to
> OPTIONS and TRACE requests with '*' URIs and Max-Forwards value of zero.

> Forwarding similar requests with positive Max-Forwards value is out of
> this change scope and still does not work, because the upstream host and

> port are not set.
>
> Co-Advisor test cases:
> test_case/rfc2616/options-bodyless-asterisk
> test_case/rfc2616/maxForwardsZero-OPTIONS-asterisk
> test_case/rfc2616/maxForwardsZero-TRACE-asterisk

* The purpose of urlCheckRequest(request) is to determine if the request
is servicable and should be updated to contain the condition:

  if ((method == METHOD_TRACE || method == METHOD_OPTIONS) &&
      (request->max_forwards == 0 && request->urlpath == "*"))
    return 1;

this removes the need all changes to client_side.cc.

url.cc:

* Please do the parser method check before the check for "urn:" unless the
request: "OPTIONS urn:*" is valid and to be rejected. Which I don't think
it is.

* Please copy the request setup from the end of the function and return
immediately from the parser after finding "*". There is no need to run
through (or change) any of the validation code in this special case.

ie:
...
  } else if ((method == METHOD_OPTIONS || method == METHOD_TRACE) &&
strcmp(url, "*") == 0) {
    if (NULL == request)
      request = new HttpRequest(method, protocol, url);
    else
      request->initHTTP(method, protocol, url);
    return request;
  } else if (!strncmp(url, "urn:", 4)) {
...

Amos
Received on Tue Aug 31 2010 - 03:49:42 MDT

This archive was generated by hypermail 2.2.0 : Wed Sep 01 2010 - 12:00:05 MDT