I'm out of my depth.

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.

Again, this is probably simple, but I'm way out of my depth here.

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

I can construct the URL without that, but actually connecting to that server with URLSession doesn't work.

(Worth noting it's HTTP not HTTPS; could ATS be stomping on me? If so, how would I know?)

Whoops. I didn't think of that. @_nd_ pointed out I need to percent-escape… the percent sign. That got me over the finish line. 🎉

https://fnordon.de/@_nd_/110881126508440982

Andreas Hartl (@[email protected])

@[email protected] my reading of https://datatracker.ietf.org/doc/html/rfc6874 is that you must percent-escape the %: http://[<IPv6address>%25<zoneID>]

Fnordon
@caseyliss @_nd_ This is classic case of the internet being awesome. There is almost always someone that not only knows the answer to your problem, but is also willing to share it.
@chrishuck @caseyliss @_nd_ As long as you have the reach for it to be seen of course. I think posting a question like this and expecting an accurate response wouldn’t work for the majority of social media users. (I’m not trying to bemoan anyone the visibility/notoriety they have earned, just pointing out that while this is a great result, it likely wouldn’t be the same for most other people.)
@chrishuck @caseyliss @_nd_ I knew the answer but I’m 11 hours behind reading my feed. RFC6874 explains how zone identifiers are represented in the authority component of a URL https://www.rfc-editor.org/rfc/rfc6874
RFC 6874: Representing IPv6 Zone Identifiers in Address Literals and Uniform Resource Identifiers

@caseyliss @_nd_ “escape the percent sign” sounds like something from a self help book