URI URL URN

Uniform Resource Identifier (URI) is a string of characters used to identify a name or a resource on the Internet. Such identification enables interaction with representations of the resource over a network (typically the World Wide Web) using specific protocols. Schemes specifying a concrete syntax and associated protocols define each URI.


Relationship to URL and URN

One can classify URIs as locators (URLs), or as names (URNs), or as both. A Uniform Resource Name (URN) functions like a person's name, while a Uniform Resource Locator (URL) resembles that person's street address. In other words: the URN defines an item's identity, while the URL provides a method for finding it.

URI的语法格式

The URI syntax consists of a URI scheme name (such as "http", "ftp", "mailto" or "file") followed by a colon character, and then by a scheme-specific part. The specifications that govern the schemes determine the syntax and semantics of the scheme-specific part. However, URI syntax does require all schemes to adhere to a general syntax that (among other things) reserves certain characters for special purposes (without always identifying those purposes). The URI syntax also enforces restrictions on the scheme-specific part in order to (for example) provide for a degree of consistency when the part has a hierarchical structure.


URN Syntax 语法


RFC 2141 (dated May 1997 and still classified as requests discussion and suggestions for improvements) describe in BNF the syntax of URNs as:

<URN> ::= "urn:" <NID> ":" <NSS>
where <NID> is the  Namespace Identifier, and <NSS> is the  Namespace Specific String. Phrases enclosed in quotes are REQUIRED. The leading "urn:" sequence is case-insensitive. The Namespace ID determines the syntactic interpretation of the Namespace Specific String.


URL 语法

Syntax

Every URL consists of some of the following: the scheme name (commonly called protocol), followed by a colon, two slashes,[note 1] then, depending on scheme, a domain name[note 2] (alternatively, IP address), a port number, the path of the resource to be fetched or the program to be run, then, for programs such as Common Gateway Interface (CGI) scripts, a query string,[7][8] and an optional fragment identifier.[9]

The syntax is
scheme://domain:port/path?query_string#fragment_id

  • The scheme name defines the namespace, purpose, and the syntax of the remaining part of the URL. Software will try to process a URL according to its scheme and context. For example, a web browser will usually dereference the URL http://example.org:80 by performing an HTTP request to the host at example.org, using port number 80. The URL mailto:bob@example.com may start an e-mail composer with the address bob@example.comin the To field.

Other examples of scheme names include https:, gopher:, wais:, ftp:. URLs with https as a scheme (such as https://example.com/) require that requests and responses will be made over a secure connection to the website. Some schemes that require authentication allow a username, and perhaps a password too, to be embedded in the URL, for example ftp://asmith@ftp.example.org. Passwords embedded in this way are not conducive to secure working, but the full possible syntax is
scheme://username:password@domain:port/path?query_string#fragment_id

  • The domain name or IP address gives the destination location for the URL. The domain google.com, or its IP address 72.14.207.99, is the address of Google's website.
  • The domain name portion of a URL is not case sensitive since DNS ignores case: http://en.example.org/ and HTTP://EN.EXAMPLE.ORG/ both open the same page.
  • The port number is optional; if omitted, the default for the scheme is used. For example, http://vnc.example.com:5800 connects to port 5800 of vnc.example.com, which may be appropriate for a VNC remote control session. If the port number is omitted for an http: URL, the browser will connect on port 80, the default HTTP port. The default port for an https: request is 443.
  • The path is used to specify and perhaps find the resource requested. It is case-sensitive, though it may be treated as case-insensitive by some servers, especially those based on Microsoft Windows. If the server is case sensitive and http://en.example.org/wiki/URL is correct,http://en.example.org/WIKI/URL/ or http://en.example.org/wiki/url/ will display an HTTP 404 error page, unless these URLs point to valid resources themselves.
  • The query string contains data to be passed to software running on the server. It may contain name/value pairs separated by ampersands, for example ?first_name=John&last_name=Doe.
  • The fragment identifier, if present, specifies a part or a position within the overall resource or document. When used with HTTP, it usually specifies a section or location within the page, and the browser may scroll to display that part of the page.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值