W3C home > Mailing lists > Public > ietf-http-wg-old@w3.org > May to August 1997

Re: 305/306 response codes

From: Josh Cohen <josh@netscape.com>
Date: Wed, 11 Jun 1997 17:37:01 -0700 (PDT)
To: Jeffrey Mogul <mogul@pa.dec.com>
Cc: Josh Cohen <josh@netscape.com>, http-wg@cuckoo.hpl.hp.com
Message-Id: <ML-3.3.866075821.2060.josh@birdcage>
Well, 
 yeah, I guess we could do that, but to be honest, I think thats more
complicated and error prone than the simple straightforward statement
of "reverse the domain name"
 plus memcmp()

 Seriously, I knew that this transformation would raise 
eyebrows to say the least.  But it does provide a non ambiguous
way to clearly specify the order of significance that we really mean.

> Jeffrey Mogul <mogul@pa.dec.com> said:
> 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

-----------------------------------------------------------------------------
Josh Cohen				        Netscape Communications Corp.
Netscape Fire Department	               	      
#include<disclaimer.h>
Server Engineering
josh@netscape.com                       http://home.netscape.com/people/josh/
-----------------------------------------------------------------------------
Received on Wednesday, 11 June 1997 17:42:16 EDT

This archive was generated by hypermail pre-2.1.9 : Wednesday, 24 September 2003 06:32:45 EDT