NULL::something

Login via flickr, はてな, TypeKey.

2006-09-02

絶対 URI, 絶対パス

少し前某所にいたとき、絶対パスを「http:// からはじまる~」と説明していたのを傍で聞いていて、なんか違うような (で、でも、わたし、正確に調べたわけじゃないし##) みたいな感じだったのでちゃんと調べる。

といっても、普通に RFC を確認するだけ。おなじみ RFC3986 を適当に調べる。と、該当部分は

  • 3.3. Path
  • 4.2. Relative Reference
  • 4.3. Absolute URI

なんだけど、こっちの RFC だと少しまわりくどいので、上書き前の RFC2396 を見てみる。もちろん若干違うのだけど、上書きされたのが最近ということを考えれば、もともとの由来はこっちにあったと考えられる。

absoluteURI   = scheme ":" ( hier_part | opaque_part )
hier_part     = ( net_path | abs_path ) [ "?" query ]
relativeURI   = ( net_path | abs_path | rel_path ) [ "?" query ]
abs_path      = "/"  path_segments
rel_path      = rel_segment [ abs_path ]

絶対 URI (absoluteURI) はスキームから始まるやつ。相対URIはパスにクエリー付けられるやつ。絶対パスは / からはじまるやつ。

URI 的にはこういうものらしい。

絶対 URI
http://example.com/
http://example.com/hogehoge.html
相対 URI
/hogehoge.html
./hogehoge.html
foo/bar.html
/search?q=%42oofy
絶対パス
/hogehoge.html
相対パス
./hogehoge.html
foo/bar.html

あと上書き後では次のようなノートが書いてあったり、定義が微妙に変わっていたり (フラグメントがどうとか) する。とりあえず相対 URI は今は正確には URI 相対参照みたいだ。

NOTE: Previous specifications used the terms "partial URI" and "relative URI" to denote a relative reference to a URI. As some readers misunderstood those terms to mean that relative URIs are a subset of URIs rather than a method of referencing URIs, this specification simply refers to them as relative references.

参照リソース

  1. RFC3986
  2. RFC2396
  3. RFC2396 3. URI Syntactic Componets
  4. RFC2396 5. Relative URI References

Trackback URI: http://lowreal.net/logs/2006/09/02/1.trackback

NULL

RSS feed meter for http://lowreal.net/logs/latest

Alternates

  1. RSS 1.0
  2. Atom 1.0

Generated with Taglibro

この日記は Taglibro と呼ばれる XML ベースの XSLT をテンプレートとして使ったシステムを使っています。現在の Taglibro は Ruby, ruby-xslt, libxml-ruby による実装です。ソースコードはとりあえず公開していません。