How to include ipv6 addresses with (or without) zone indexes in uri for .net remoting?

*爱你&永不变心* 提交于 2019-12-06 16:35:36

The zone indexes won't mean anything to other systems. (Your zone index 10 might be someone else's zone index 25, eth0, en0, etc, depending on the network interface that happens to be in use for that particular network, and the platform.) Plus, since they are link-local addresses, (you can tell because they start with fe80::) they are only usable if they are being advertised to other machines on the local LAN, anyway.

I would suggest you not advertise IPv6 link-local addresses. If you must advertise them, see if there is a way to advertise them only to specific interfaces and leave off the zone index. Other systems would need to know that link-local addresses are only usable from the same interface they were received from.

Far better would be to add an IPv6 router to your network, and use only global unicast addresses.

From a reading of RFC 3986, I think the correct output would be something like tcp://[fe80::a8e8:2b42:3c07:c04a%2510]:port/name -- you have to encode the % as %25, otherwise your zone index is seen as a percent-encoded character! On the other hand, §3.2.2 says:

The ABNF provided here is a translation of the text definition of an IPv6 literal address provided in [RFC3513]. This syntax does not support IPv6 scoped addressing zone identifiers.

...so a URI with a zone index might not conform to that RFC, depending on how you read it.

ETA: Oh here we go, RFC 6874 updates 3986 to describe the interaction. Yes, you need to escape the percent sign.

(I'm in the middle of writing a URL parsing, manipulation, and formatting library and am currently a bit stuck on how to handle zone indexes, given that the spec is a bit cool on them and they're not much in use...)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!