{"id":40334,"date":"2023-08-14T14:40:31","date_gmt":"2023-08-14T18:40:31","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=40334"},"modified":"2023-08-14T14:40:59","modified_gmt":"2023-08-14T18:40:59","slug":"making-an-ipv6-urlrequest","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2023\/08\/14\/making-an-ipv6-urlrequest\/","title":{"rendered":"Making an IPv6 URLRequest"},"content":{"rendered":"<p><a href=\"https:\/\/fnordon.de\/@caseyliss@mastodon.social\/110879648938391422\">Casey Liss<\/a>:<\/p>\n<blockquote cite=\"https:\/\/fnordon.de\/@caseyliss@mastodon.social\/110879648938391422\"><p>I&rsquo;m trying to make a URL GET request to a service I&rsquo;m discovering via Bonjour.<\/p><p>I have gotten a <code>NWBrowser.Result<\/code>, and I&rsquo;ve gotten an <code>NWEndpoint<\/code>.<\/p><p>The endpoint is an IPv6 link local address.<\/p><p>How the hell do I make a <code>URLRequest<\/code> to this? I don&rsquo;t seem to be able to construct a URL from what I&rsquo;ve got, but I suspect I&rsquo;m holding it wrong.<\/p><p>[&#8230;]<\/p><p>Wait, it seems the presence of &ldquo;%en0&rdquo; at the end may be the problem?<\/p><\/blockquote>\n\n<p><a href=\"https:\/\/mastodon.social\/@gc_headtech\/110879667216976458\">Greg Thompson<\/a>:<\/p>\n<blockquote cite=\"https:\/\/mastodon.social\/@gc_headtech\/110879667216976458\">\n<p>In a browser you would enter an IPV6 address <a href=\"https:\/\/datatracker.ietf.org\/doc\/html\/rfc2732#section-2\">like this<\/a>: <tt>https:\/\/[XXXXXIPV6ADDRESS]\/index.html<\/tt><\/p>\n<\/blockquote>\n\n<p><a href=\"https:\/\/fnordon.de\/@_nd_\/110881126508440982\">Andreas Hartl<\/a>:<\/p>\n<blockquote cite=\"https:\/\/fnordon.de\/@_nd_\/110881126508440982\">\n<p>my reading of <a href=\"https:\/\/datatracker.ietf.org\/doc\/html\/rfc6874\">RFC 6874<\/a> is that you must percent-escape the %: <tt>http:\/\/[&#60;IPv6address&#62;%25&#60;zoneID&#62;]<\/tt><\/p>\n<\/blockquote>\n\n<p><a href=\"https:\/\/mastodon.social\/@chucker@norden.social\/110882803896294981\">Jira Burnout Chart<\/a>:<\/p>\n<blockquote cite=\"https:\/\/mastodon.social\/@chucker@norden.social\/110882803896294981\">\n<p>TIL about encoding a desired network interface as part of the host name into a URL<\/p>\n<\/blockquote>\n\n<p>It&rsquo;s interesting that he asked on Mastodon rather than on Stack Overflow.<\/p>\n\n<p>See also:<\/p>\n<ul><li><a href=\"https:\/\/apenwarr.ca\/log\/20170810\">The world in which IPv6 was a good design<\/a> (via <a href=\"https:\/\/news.ycombinator.com\/item?id=37116487\">Hacker News<\/a>)<\/li>\n<li><a href=\"http:\/\/cr.yp.to\/djbdns\/ipv6mess.html\">The IPv6 mess<\/a> (via <a href=\"https:\/\/news.ycombinator.com\/item?id=37119370\">Hacker News<\/a>)<\/li><\/ul>\n\n<p>Previously:<\/p>\n<ul>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2023\/07\/28\/the-mess-at-stack-overflow\/\">The Mess at Stack Overflow<\/a><\/li>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2016\/11\/21\/the-monkey-and-the-apple\/\">The Monkey and the Apple<\/a><\/li>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2023\/03\/10\/roku-doesnt-support-ipv6\/\">Roku Doesn&rsquo;t Support IPv6<\/a><\/li>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2015\/07\/22\/north-america-out-of-new-ipv4-addresses\/\">North America Out of New IPv4 Addresses<\/a><\/li>\n<\/ul>","protected":false},"excerpt":{"rendered":"<p>Casey Liss: I&rsquo;m trying to make a URL GET request to a service I&rsquo;m discovering via Bonjour.I have gotten a NWBrowser.Result, and I&rsquo;ve gotten an NWEndpoint.The endpoint is an IPv6 link local address.How the hell do I make a URLRequest to this? I don&rsquo;t seem to be able to construct a URL from what I&rsquo;ve [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2023-08-14T18:40:34Z","apple_news_api_id":"ec648a4a-5af4-42b3-9f9f-d9ee8ad2ad23","apple_news_api_modified_at":"2023-08-14T18:41:01Z","apple_news_api_revision":"AAAAAAAAAAAAAAAAAAAAAA==","apple_news_api_share_url":"https:\/\/apple.news\/A7GSKSlr0QrOfn9nuitKtIw","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[1468,31,2185,30,2223,1718,476,71,1877,489],"class_list":["post-40334","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-bonjour","tag-ios","tag-ios-16","tag-mac","tag-macos-13-ventura","tag-mastodon","tag-networking","tag-programming","tag-stack-overflow","tag-url"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/40334","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=40334"}],"version-history":[{"count":2,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/40334\/revisions"}],"predecessor-version":[{"id":40336,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/40334\/revisions\/40336"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=40334"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=40334"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=40334"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}