<scheme>://<user>:<password>@<host>:<port>/<path>;<params>?<query>#<frag>
几乎所有URL都有scheme,host,path
参照 HTTP权威指南29页
scheme 方案 http ftp smtp等等
params 有时候仅有主机名和路径不够,比如ftp有两种传输格式 binary 和 text,传图片必须是binary。比如 ftp://prep.ai.mit.edu/pub/gnu;type=d,其中type=d就是参数。又比如,http://www.joes-hardware.com/hammers;sale=false/index.html;graphics=true有两个参数,sale=false和graphics=true,表示参数sale的值为false,graphics的值为true。
query 查询。比如http://www.joes-hardware.com/inventory-check.cgi?item=12731&color=blue&size=large中item=12731,color=blue,size=large为query。
frag 片段。比如http://www.joes-hardware.com/tools.html#drills中drills就是frag。浏览器发送http://www.joes-hardware.com/tools.html,服务器回复http://www.joes-hardware.com/tools.html这个页面,这个页面中有个<A NAME=drills></A>的标签,浏览器直接定位到这儿。(HTTP权威指南33页)
URL中特殊字符转义。空格0x20就是%20,% 0x25就是%25,~0x7E就是%7E。即 %+对应ASCII编码 即可。