URL简述

杂述:

通常如果一样东西需要编码,则说明这样东西不适合传输。如size过大、包含隐私等
之所以要进行编码,是因为url中包含的有些字符会引起歧义
url编码格式采用的是ASCLL而不是Unicode‘
URL编码原则:使用安全的字符(没有特殊用途或者特殊意义的可打印字符)去表示那些不安全的字符。
URLI是统一资源标识,URL是URI的一种

URL概念

A URL is a universal identifier. To disambiguate from a valid URL string it can also be referred to as a URL record.(URL是一个通用标识符。要消除有效URL字符串的歧义,还可以将其称为URL记录。)
A URL’s scheme is an ASCII string that identifies the type of URL and can be used to dispatch a URL for further processing after parsing. It is initially the empty string.(URL的模式是一个ASCII字符串,它标识URL的类型,并可用于在解析后分派URL以进行进一步处理。它最初是空字符串。)
A URL’s username is an ASCII string identifying a username. It is initially the empty string.(URL的用户名是标识用户名的ASCII字符串。它最初是空字符串。)
AURL‘s password is an ASCll string identifying a password. It is initially the empty string(URL的密码是标识密码的ASll字符串。它最初是空字符串)
A URL’s host is null or a host. It is initially null(URL的host空或者是一个host,它最初是空)

The following table lists allowed URL’s scheme/host combinations:

在这里插入图片描述
A URL’s port is either null or a 16-bit unsigned integer that identifies a network port. It is initially null.(URL的端口要么为空,要么为标识网络端口的16位无符号整数。它最初是空的。)
A URL’s path is a list of zero or more ASCll strings holding data, usually identifying a location in hierarchical form .It is initially empty.(URL的路径是包含数据0个或多个ASCII字符串的列表,通常以层次结构的形式标识位置。它最初是空的。)
A URL’s query is either null or an ASCll string holding data. It is initially null(URL的查询要么为空,要么为保存数据的ASCII字符串。它最初是空的)
A URL’s fragment is wither null or an ASCll string holding data that can be used for further processing on the resource the URL’s other components identify. It is initially null(URL的片段要么为空,要么为包含数据的ASCII字符串,这些数据可用于对URL的其他组件标识的资源进行进一步处理。它最初是空的。)
A URL also has an associated cannot-be-a-base-URL flag.It is initially unset(URL还有一个关联的can -be- A -base-URL标志。它最初是未设置的。)
A URL also has an associated blob URL entry that is either null or a blob URL entry. It is initially null.(URL还有一个关联的blob URL条目,该条目要么为空,要么为blob URL条目。它最初是空的。)

URL组成:

在这里插入图片描述
Schem(协议部分):
协议名称是由一串不区分大小写的字母组成,以:作为结束符。协议表示的是获取该资源需要使用的协议,如http、https、ftp等
//(层级URL标识符号):
这个符号是固定的,可以理解为把协议与后面的信息分隔开来
Login:passord(身份验证)
这是一个可选部分,一般的协议都会使用默认的匿名形式进行数据获取,该部分以@作为该部分的结束符号
Address部分:服务器地址
这部分关系到你需要从那个服务器上去获取资源,这部分大多以域名(www.com)的形式呈现,还有以IPV4(127.0.0.80)的地址呈现,也能够以IPV6的形式呈现
按照标准的描述是这部分只能用 数字、“."、“-"组成
Port:服务器端口
这里是属于网络端口,16位,这里的端口并不是物理端口,而是逻辑端口。只要是为了处理多进程时数据进行传输的时候,保证各进程中数据不会发生紊乱,能够传送到相应的进程中所设定的。不同网络协议都有自己特定的端口号
/path/to/resource/:文件路径
URL指向的是一个唯一确定的资源,而这里指向的是资源的完整路径(即存储位置),一般使用“/”进行分层描述
?query_string:查询字符串
用于传递参数给服务器。以“?”开始,允许有多个参数,参数之间以“$”分隔
** #fragment**:片段ID
该部分与query部分的本质区别是这部分内容不会被传递到服务器端。一般用于页面的锚。就是常见的网站右下角一般有一个回到顶部的按钮,一般就是使用fragment实现的

URL Writing
  • A valid URL string must be either a relative-URL-with-fragment string or an absolute-URL-with-fragment string.(有效的URL字符串必须是相对URL-with-fragment字符串或绝对URL- URL-with-fragment字符串。)
  • An absolute-URL-with-fragment string must be an absolute-URL string, optionally followed by U+0023 (#) and a URL-fragment string.(一个带片段的绝对url字符串必须是一个绝对url字符串,后面跟着U+0023(#)或一个URL-fragment string。)

An absolute-URL string must be one of the following

  • a URL-scheme string that is an ASCII case-insensitive match for a special scheme and not an ASCII case-insensitive match for “file”, followed by U+003A (: ) and a scheme-relative-special-URL string(一个URL-scheme字符串,它是一个特殊格式的ASCII不区分大小写匹配,不是“file”的ASCII不区分大小写匹配,后面跟着U+003A(:)和a scheme-relative-special-URL string)
  • a URL-scheme string that is not an ASCII case-insensitive match for a special scheme, followed by U+003A (: ) and a relative-URL string
  • a URL-scheme string that is an ASCII case-insensitive match for “file”, followed by U+003A (: ) and a scheme-relative-file-URL string
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值