What is the difference between a URI, a URL and a URN?

前端 未结 30 1253
小蘑菇
小蘑菇 2020-11-22 02:18

People talk about URLs, URIs, and URNs as if they\'re different things, but they look the same to the naked eye.

W

30条回答
  •  隐瞒了意图╮
    2020-11-22 02:50

    Identity = Name with Location

    Every URL(Uniform Resource Locator) is a URI(Uniform Resource Identifier), abstractly speaking, but every URI is not a URL. There is another subcategory of URI is URN (Uniform Resource Name), which is a named resource but do not specify how to locate them, like mailto, news, ISBN is URIs. Source

    URN:

    • URN Format : urn:[namespace identifier]:[namespace specific string]
    • urn: and : stand for themselves.
    • Examples:
      • urn:uuid:6e8bc430-9c3a-11d9-9669-0800200c9a66
      • urn:ISSN:0167-6423
      • urn:isbn:096139210x
      • Amazon Resource Names (ARNs) is a uniquely identify AWS resources.
        • ARN Format : arn:partition:service:region:account-id:resource

    URL:

    • URL Format : [scheme]://[Domain][Port]/[path]?[queryString]#[fragmentId]
    • :,//,? and # stand for themselves.
    • schemes are https,ftp,gopher,mailto,news,telnet,file,man,info,whatis,ldap...
    • Examples:
      • http://ip_server/path?query
      • ftp://ip_server/path
      • mailto:email-address
      • news:newsgroup-name
      • telnet://ip_server/
      • file://ip_server/path_segments
      • ldap://hostport/dn?attributes?scope?filter?extensions

    Analogy:
    To reach a person: Driving(protocol others SMS, email, phone), Address(hostname other phone-number, emailid) and person name(object name with a relative path).

提交回复
热议问题