Appendix B. URI 示例
Appendix B. URI 示例 (URI Examples)
以下示例展示了不同的 Uri 选项集合, 以及由这些选项构造 URI 后得到的结果. 除这些选项外, 第 6.5 节还会引用目标 IP 地址和端口, 但并非算法的所有路径都会使目标 IP 地址和端口被包含在 URI 中.
示例 1:
- 输入 (Input):
Destination IP Address = [2001:db8::2:1]
Destination UDP Port = 5683
- 输出 (Output):
coap://[2001:db8::2:1]/
示例 2:
- 输入 (Input):
Destination IP Address = [2001:db8::2:1]
Destination UDP Port = 5683
Uri-Host = "example.net"
- 输出 (Output):
coap://example.net/
示例 3:
- 输入 (Input):
Destination IP Address = [2001:db8::2:1]
Destination UDP Port = 5683
Uri-Host = "example.net"
Uri-Path = ".well-known"
Uri-Path = "core"
- 输出 (Output):
coap://example.net/.well-known/core
示例 4:
- 输入 (Input):
Destination IP Address = [2001:db8::2:1]
Destination UDP Port = 5683
Uri-Host = "xn--18j4d.example"
Uri-Path = the string composed of the Unicode characters U+3053
U+3093 U+306b U+3061 U+306f, usually represented in UTF-8 as
E38193E38293E381ABE381A1E381AF hexadecimal
- 输出 (Output):
coap://xn--18j4d.example/
%E3%81%93%E3%82%93%E3%81%AB%E3%81%A1%E3%81%AF
上述换行仅为便于阅读而插入, 不属于 URI 的一部分.
示例 5:
- 输入 (Input):
Destination IP Address = 198.51.100.1
Destination UDP Port = 61616
Uri-Path = ""
Uri-Path = "/"
Uri-Path = ""
Uri-Path = ""
Uri-Query = "//"
Uri-Query = "?&"
- 输出 (Output):
coap://198.51.100.1:61616//%2F//?%2F%2F&?%26