Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sockaddr authority #624

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

mcr
Copy link

@mcr mcr commented Sep 13, 2023

This adds the ability to create an authority object from a SocketAddr.

While many web interactions start with a URL, there are others that start from a mDNS, DNS-SD or GRASP (RFC8990) discovery. IP addresses (often link-local), port numbers (and IPv6 scope) are returned from the discovery, but one then needs to form a URI for the relevant HTTP library.
(Although the application usually has to open the socket itself, a URI is often still required for Host: header, and path+query string)

Perhaps this should be hidden behind some feature to avoid a dependency upon net.
Probably this should also be behind no_std, since byte strings are created.

I was surprised that the URI was not parsed into pieces and pointed to separately, but I see the logic for this.
I would prefer to put this into authority because that keeps the knowledge about what are valid and invalid URIs in one place.
(Thank you, btw, for supporting RFC6874, and note draft-ietf-6man-rfc6874bis/ about to be published)

@mcr
Copy link
Author

mcr commented Sep 13, 2023

@becarpenter might have some test cases to add.

@becarpenter
Copy link

I don't have context to know what sort of test cases you would want. There are examples in draft-ietf-6man-rfc6874bis.
Re RFC6874(bis), note that the bis document removes the need to replace "%" by "%25". The impact of that depends on fine details of the URL parser. My fix for the WGET parser is at https://github.com/becarpenter/wget6, and the way WGET is coded means that it accepts both RFC6874 and RFC6874bis formats.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants