RE: on "How to Compare Uniform Resource Identifiers"

> -----Original Message-----
> From:	Dan Connolly [SMTP:connolly@w3.org]
> Sent:	Monday, January 13, 2003 12:02 PM
> To:	www-tag@w3.org
> Subject:	on "How to Compare Uniform Resource Identifiers"
> 
> | Such comparisons can have two outcomes, in this document labeled 
> | "equivalent" and "different"."
> 
> er... what about "identical"?
> 
> Also: this suggests that there's just one relationship
> between URIs. I think it's CRITICAL to be 100% clear
> that there are several:
> 
> 	identical, i.e. string-equal
> 	dns-equivalent, e.g. http://www.w3.org/ and http://WWW.W3.ORG/
> 	http-scheme-equivalent,
> 		e.g. http://Example.COM:80/ and http://example.com:80/
> 	cache-hit-likely-equivalent, e.g.
> 		http://example/ and http://example/index.html
> 
While I was writing perl test code for Tim B's query about what case in escaping, I figured I might was well test these examples as well:

$ cat uri_eq.pl
use URI ;

$\ = "\n" ;

print "Perl Version: $]" ;
print "URI::Version: $URI::VERSION" ;
print "identical"
	if URI::eq ("http://www.w3.org/", "http://www.w3.org/") ;
print "dns-equivalent"
	if URI::eq ("http://www.w3.org/", "http://WWW.W3.ORG/") ;
print "http-scheme-equivalent"
	if URI::eq ("http://Example.COM:80/", "http://example.com/") ;
print "cache-hit-likely-equivalent"
	if URI::eq ("http://example", "http://example/index.html") ;
print "escape-equivalent"
	if URI::eq ("http://www.w3.org/a:b", "http://www.w3.org/a%3Ab") ;

$ perl uri_eq.pl
Perl Version: 5.006001
URI::Version: 1.17
identical
dns-equivalent
http-scheme-equivalent

That is, the 1st 3 are "eq" while the last 2 are not.  Note, I made the http-scheme-equivalent test more interesting but removing the default port from one argument...and I added another test for escaping equivalence.

pvb

Received on Friday, 24 January 2003 17:41:08 UTC