Uniform Resource Locators (URL)

http://tools.ietf.org/html/rfc1738

上面链接的RFC详细介绍了URL的范式,URL是URI的子集。

 

URL的一般格式

<scheme>:<scheme-specific-part>
 
scheme有如下几种(不限于,详见RFC1738):
   ftp                     File Transfer protocol
   http                    Hypertext Transfer Protocol
   gopher                  The Gopher protocol
   mailto                  Electronic mail address
   news                    USENET news
   nntp                    USENET news using NNTP access
   telnet                  Reference to interactive sessions
   wais                    Wide Area Information Servers
   file                    Host-specific file names
   prospero                Prospero Directory Service
 
 

scheme为http的URL

一般格式为:
http://<host>:<port>/<path>?<searchpart>
 
 

超文本传输协议(HTTP)的统一资源定位符将从因特网获取信息的五个基本元素包括在一个简单的地址中:

  1. 传送协议。
  2. 服务器。
  3. 端口号。(以数字方式表示,若为HTTP的默认值“:80”可省略)
  4. 路径。(以“/”字符区别路径中的每一个目录名称)
  5. 查询。(GET模式的窗体参数,以“?”字符为起点,每个参数以“&”隔开,再以“=”分开参数名称与数据,通常以UTF8的URL编码,避开字符冲突的问题)

典型的统一资源定位符看上去是这样的:

http://zh.wikipedia.org:80/w/index.php?title=Special:%E9%9A%8F%E6%9C%BA%E9%A1%B5%E9%9D%A2&printable=yes

其中:

  1. http,是协议;
  2. zh.wikipedia.org,是服务器;
  3. 80,是服务器上的网络端口号
  4. /w/index.php,是路径;
  5. ?title=Special:%E9%9A%8F%E6%9C%BA%E9%A1%B5%E9%9D%A2&printable=yes,是询问。
posted @ 2013-06-15 14:33  helloweworld  阅读(246)  评论(0编辑  收藏  举报