Monday, August 14, 2023

Making an IPv6 URLRequest

Casey Liss:

I’m trying to make a URL GET request to a service I’m discovering via Bonjour.

I have gotten a NWBrowser.Result, and I’ve gotten an NWEndpoint.

The endpoint is an IPv6 link local address.

How the hell do I make a URLRequest to this? I don’t seem to be able to construct a URL from what I’ve got, but I suspect I’m holding it wrong.

[…]

Wait, it seems the presence of “%en0” at the end may be the problem?

Greg Thompson:

In a browser you would enter an IPV6 address like this: https://[XXXXXIPV6ADDRESS]/index.html

Andreas Hartl:

my reading of RFC 6874 is that you must percent-escape the %: http://[<IPv6address>%25<zoneID>]

Jira Burnout Chart:

TIL about encoding a desired network interface as part of the host name into a URL

It’s interesting that he asked on Mastodon rather than on Stack Overflow.

See also:

Previously:

Comments RSS · Twitter · Mastodon

Leave a Comment