W3C home > Mailing lists > Public > www-tag@w3.org > January 2003

RE: on "How to Compare Uniform Resource Identifiers"

From: Biron,Paul V <Paul.V.Biron@kp.org>
Date: Fri, 24 Jan 2003 14:36:09 -0800
Message-Id: <8904C60CACA7D51191BC00805FEAAF430117219E@crdc-exch-7.crdc.kp.org>
To: "'Dan Connolly'" <connolly@w3.org>, www-tag@w3.org

> -----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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 26 April 2012 12:47:15 GMT