URL格式有一件有趣的事:
URL 路径段中的参数。
有关详细信息,请参阅
中的“2.2.5”部分
“O'Reilly - HTTP - 权威指南”。
这本书可以在网上免费找到。
或在官方规范中 https://www.ietf.org/rfc/rfc2396.txt 第 3.3 节。
3.3. Path Component
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:
http://www.example.com/first-segment/second-segment/index.html?type=HelloWorld
此处 /first-segment/second-segment/index.html
是 URL 的路径部分。
first-segment
是该路径的第一段second-segment
是该路径的第二段index.html
是该路径的第三段
在那本书中指出,每个段都可以有单独的参数,用分号“;”分隔。在我们的示例中,它可能是:
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
问题是:您知道 URL 中此类参数的任何实际示例吗?
最佳答案
我不知道路径段中确切参数的任何示例。
但最接近的例子是(过期)SFTP URL proposal 中的连接和 SFTP 参数.
有人提议 connection parameter ,SSH主机 key 指纹的指纹
:
sftp://username:password;fingerprint=ssh-dss-0b-77-...@example.com/
还有一个提议SFTP parameter ,传输模式的 typecode
(ascii 与二进制)。没有官方的例子,但应该是这样的:
sftp://username:password@example.com/path/file;typecode=i
(实际上,虽然在语义上有所不同,但具有您的“路径”参数的语法)
关于http - URL 路径段中的参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40440004/