http - URL 路径段中的参数

标签 http url https ftp ftps

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 的路径部分。

  1. first-segment 是该路径的第一段
  2. second-segment 是该路径的第二段
  3. index.html 是该路径的第三段

在那本书中指出,每个段都可以有单独的参数,用分号“;”分隔。在我们的示例中,它可能是:

http://www.example.com/first-segment;f1=WWW/second-segment;s1=1;s2=2/index.html;i1=100;abc=200?type=HelloWorld
  1. 此处 f1 - first-segment 的参数
  2. s1s2 - second-segment
  3. 的参数
  4. i1abc 参数用于 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/

相关文章:

http - 如何为ServiceStack自定义HTTP-500错误页面?

C# HttpClient.PostAsync 并等待崩溃的应用程序

java - ".123"不接受 Spring Rest 请求 406

perl - WWW::Mechanize::Timed https 超时不起作用

java - 使用 jSoup 解析网站

php - 通过 HTTP 发送大文件

javascript - 在 last/之后添加到 URL

ruby-on-rails - Rails 在 url 中使用 '.' 截断参数

internet-explorer - IE7 : This page contains both secure and nonsecure items

asp.net - HTTP POST 不适用于 Internet Explorer 8(重定向后)