问题描述
URL格式有一件有趣的事情:
URL路径段中的参数.
There is one interesting thing in URL format:
Parameters in Path Segments of URL.
有关更多信息,请参见
中的"2.2.5"部分" O'Reilly-HTTP-权威指南".
For more information see section "2.2.5" in
"O'Reilly - HTTP - The Definitive Guide".
可以在Internet上免费找到这本书.
This book can be found freely in Internet.
或在官方规范中 https://www.ietf.org/rfc/rfc2396.txt 第3.3节.
or in official specificationhttps://www.ietf.org/rfc/rfc2396.txtsection 3.3.
路径组件包含特定于授权机构(或 方案(如果没有权限组件),则标识资源
在该计划和权限的范围内.
The path component contains data, specific to the authority (or the scheme if there is no authority component), identifying the resource
within the scope of that scheme and authority.
path = [ abs_path | opaque_part ]
path_segments = segment *( "/" segment )
segment = *pchar *( ";" param )
param = *pchar
pchar = unreserved | escaped |
":" | "@" | "&" | "=" | "+" | "$" | ","
让我们考虑以下URL:
Let's consider the following URL:
http://www.example.com/first-segment/second-segment/index.html?type=HelloWorld
此处/first-segment/second-segment/index.html
是URL的路径部分.
Here /first-segment/second-segment/index.html
is a Path part of URL.
-
first-segment
是该路径的第一段 -
second-segment
是该路径的第二段 -
index.html
是该路径的第三段
- And
first-segment
is a first segment of that Path second-segment
is a second segment of that Pathindex.html
is a third segment of that Path
该书中指出,每个段都可以有单独的参数,并用分号;"分隔.在我们的示例中,可能是:
It is stated in that book that each segment could have individual Parameters separated by semicolon ";". In our example it could be:
http://www.example.com/first-segment;f1=WWW/second-segment;s1=1;s2=2/index.html;i1=100;abc=200?type=HelloWorld
- 此处
f1
-first-segment
的参数 -
s1
和s2
-second-segment
的参数 -
i1
和abc
参数
index.html
的- Here
f1
- parameter forfirst-segment
s1
ands2
- parameters forsecond-segment
i1
andabc
parameters forindex.html
问题是:您知道URL中此类参数的任何实际示例吗?
The question is: do you know any practical examples of such Parameters in URLs?
推荐答案
我不知道路径段中确切参数的任何示例.
I do not know any example of exactly parameters in the path segment.
但最接近的示例是(已过期) SFTP URL提议.
But close example is connection and SFTP parameters in (expired) SFTP URL proposal.
有一个建议的连接参数,SSH主机密钥指纹的fingerprint
:
There's one proposed connection parameter, the fingerprint
for SSH host key fingerprint:
sftp://username:password;[email protected]/
和一个建议的 SFTP参数,用于传输模式的typecode
(ASCII与二进制).没有官方示例,但应该像这样:
And one proposed SFTP parameter, the typecode
for transfer mode (ascii vs. binary). There's no official example, but it should be like:
sftp://username:[email protected]/path/file;typecode=i
(实际上在语义上有所不同,但具有"path"参数的语法)
(what actually, while semantically different, has the syntax of your "path" parameter)
这篇关于URL路径段中的参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!