[1] URL は同じものを表すにも関わらず複数の表現方法がある場合が数多く存在します。 その一方で、 URL (によって表されるもの) が同一かどうか判定したいこともあります。 それ故、2つの URL が同一かどうかを判定する比較演算を定義する必要が生じます。 比較演算の定義に当たっては正規化の方法を規定し、それによる正規形の比較を用いることもあります (もちろん正規化なしで比較を定義することもあります)。 なお、正規化は純粋な比較のため以外にも部品の取り出しやパターン一致のために使われることがありますし、 人間が読むためにも便利です。
[22] URL は表現の自由度が極めて高く、しかも様々な場面で使われているため、 比較と正規化の方法は色々定義されています。 比較や正規化のコストを無視できないというのも様々なバリエーションが生まれる要因となっています。
[15] URL Standard の登場まで、 URL (として解釈される文字列) に対する構文解析、解決、 比較と正準化といった各演算の関係は明確に理解されていませんでした。
[18] URL Standard は構文解析、解決、 基本的な正準化を1つの不可分の演算として改めて正確に定義し、 比較はその結果について (あるいは場合によっては文脈依存の更なる演算を経たものについて) 行うものとしました。
[23] 最も単純なのが、 URL を単純に文字列として比較する、というものです。
[24] ほとんど自明な比較方法に思えますが、単純比較すら、いくつかバリエーションが考えられます。
[29] 普通は >>25 だろう、と思えるかもしれませんが、規定をよく読むと比較演算への入力が元々の入力そのものではなく解決後の URL だったり、RFC 3986 URI 上の演算として定義されていたりするので注意が必要です。
[30] 普通は仕様上は文字列に対して比較が定義されていますが、現実の実装はしばしばバイト列に対して比較が実装されていたりして、 非ASCII文字が含まれる時に結果が変わってしまうことがあるので、やはり注意が必要です。
[45] 次の比較演算は、 URL記録について定義されています。つまり
URL構文解析器で URL としての基本的な正準化がなされた結果に対して比較するものです。
[13] URL と URL との比較ではなく、 URL とURLの集合との比較が用いられることもあります。 詳しくは URLパターンも参照。
[48] 要求対象の処理では、 absolute-form
のパスが空かどうかの判定が必要となる場合があります。
absolute-form
参照。In many cases, different URI strings may actually identify the identical resource. For example, the host names used in URL are actually case insensitive, and the URL http://www.XEROX.com is equivalent to http://www.xerox.com. In general, the rules for equivalence and definition of a normal form, if any, are scheme dependent. When a scheme uses elements of the common syntax, it will also use the common syntax equivalence rules, namely that the scheme and hostname are case insensitive and a URL with an explicit ":port", where the port is the default for the scheme, is equivalent to one where the port is elided.
[20] Wondering around: Java's URL little secret ( 版) http://www.eishay.com/2008/04/javas-url-little-secret.html
[21] OWL 2 Web Ontology Language Structural Specification and Functional-Style Syntax ( 版) http://www.w3.org/TR/2009/REC-owl2-syntax-20091027/#IRIs
[34] RFC 6021 - Common YANG Data Types ( 版) http://tools.ietf.org/html/rfc6021
[37] RFC 6943 - Issues in Identifier Comparison for Security Purposes ( ( 版)) http://tools.ietf.org/html/rfc6943#section-3.3
[38] RDF 1.1 Concepts and Abstract Syntax ( ( 版)) https://dvcs.w3.org/hg/rdf/raw-file/default/rdf-concepts/index.html#dfn-iri-equality
[39] RFC 7252 - The Constrained Application Protocol (CoAP) ( ( 版)) http://tools.ietf.org/html/rfc7252#section-6.3
[42] IRC logs: freenode / #whatwg / 20140903 ( ( 版)) http://krijnhoetmer.nl/irc-logs/whatwg/20140903#l-914
[43] Web Applications 1.0 r8739 Attempt to mitigate the injection elevation attack on appcache, and describe the attack in detail ( ( 版)) http://html5.org/r/8739
[4] XRD は URL scheme 依存の正規化の規則により比較する >>2 としています。
[5] Protocolv2Spec - google-safe-browsing - Client specification for the Google Safe Browsing v2.2 protocol - protect users from malicious web pages - Google Project Hosting ( 版) https://code.google.com/p/google-safe-browsing/wiki/Protocolv2Spec#6.1._Canonicalization
[6] Phishing Protection: Server Spec - MozillaWiki ( 版) https://wiki.mozilla.org/Phishing_Protection:_Server_Spec#Canonical_Hostname_Creation
These URI attributes specify EQUALITY matching with
'caseIgnoreMatch' (rather than with 'caseExactMatch') in order to
conform to the spirit of [STD66], which requires case-insensitive
matching on the host part of a URI versus case-sensitive matching
on the remainder of a URI.
These URI attributes follow existing practice of supporting
case-insensitive equality matching for host names in the
associatedDomain attribute defined in [RFC4524].
[11] Define URL equivalence. Fixes https://www.w3.org/Bugs/Public/show_bug… · whatwg/url@3f0bc8b ( 版) https://github.com/whatwg/url/commit/3f0bc8b84d2f3bdb651207ce0f90c659c3a5a573
Metadata Discovery and Compatibility involve comparing URLs. When comparing URLs, processors must use Syntax-Based Normalization as defined in [RFC3968]. Processors must perform Scheme-Based Normalization for HTTP (80) and HTTPS (443) and should perform Scheme-Based Normalization for other well-known schemes.
[44] Sniffly for ports. (mikewest著, ) https://github.com/w3c/webappsec-csp/commit/22d08b990290e49f5a666fad08de16d75bb369e7