Re: 305/306 response codes

I'm not sure how I feel about the rest of the draft (although
I will note, as I said in Memphis, that at the IP level the
ability to use ICMP Redirect messages has proved to be extremely
useful, and by analogy this *suggests* that a carefully defined
HTTP-level redirection mechanism could be a win).

But on a specific, small point:
    * URL transformation for scope.
      reversing the domain name is unlike most other formats.
      The benefit here is it expresses the correct order
      of diminishing significance, and allows a simple memcmp()
      in implementation.
      Alternatively, to acheiv eht same functionality we'd need
      to allow wildcards, ie *.ups.com, which is a non-trivial
      comparision, which can be costly.

I think reversing the hostname in the URL is a mistake.  It's
likely to lead to confusion.

It's not necessary to use arbitrary wildcards (although I don't
believe this is all that costly; lots of nice regular-expression
code is floating around out there).  All you really want is
to specify suffixes, and to be able to distinguish a suffix
from a FQDN.

I.e., if a site has two Web servers,
	a.com
and
	www.a.com

then you might not want the string "a.com" to be confused with
a suffix of "www.a.com".  But I think you could probably
use ".a.com" to specify a suffix, or else allow a __single__
"*" at the beginning of the domain name (e.g., "*.a.com").

If you follow the former approach (i.e., no "*" involved), then
the matching algorithm is simply

    DoesItMatch(char *scope, char *URL)
    {
	int slen, ulen, offset;
	char *URLsuffix;

	slen = strlen(scope);
	ulen = strlen(url);
	
	if (slen > ulen) return(0);	/* no match possible */
	
	offset = ulen - slen;
	URLsuffix = &(URL[offset]);
	
	return(memcmp(scope, URLsuffix, slen) == 0);
    }

This is basically O(N) in the length of the strings.  It's
probably cheaper than trying to reverse the order of the components
of a domain name, which requires some level of actual parsing.

Bottom line: reversal isn't worth it.

-Jeff

Received on Wednesday, 11 June 1997 16:04:25 UTC