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

Url struct layout makes processing URIs in servers difficult #12

Closed
mikedilger opened this issue Aug 20, 2014 · 4 comments
Closed

Url struct layout makes processing URIs in servers difficult #12

mikedilger opened this issue Aug 20, 2014 · 4 comments

Comments

@mikedilger
Copy link
Contributor

Coming from a URI perspective (RFC 3986) and a webserver perspective, there are strings which contain (path,query,fragment) but omit (scheme,username,password,host,port). These are relative to a web server. I'm working on an OAuth2 library and an REST API library, both of which are server side or have server-side components, and work with such strings.

The way the URL struct is is broken down (path being way down in RelativeSchemeData) makes it difficult to parse/represent (path,query,fragment) type strings. I'm having brief moments of insanity where I'm on the verge of writing another differently structured URI rust library to address this. Could rust-url address my concerns... or is the data structure layout pretty much settled?

As an aside, what is the status/acceptance of http://url.spec.whatwg.org/ ? Is it really the standard that the majority of software providers aspire to for URLs? And whence went URIs? Seems a drastic break from when mention of URLs nearly disappeared from IETF standards, as this one almost fails to mention URIs.

@SimonSapin
Copy link
Member

Regarding rust-url: nothing is set in stone. Quite the opposite, it’s very much a work in progress. I’m aware that some use cases are not covered yet, and interested in what kind of data structure and API you think would help. I’d definitely ask that we try to figure something out together before you go off and start a competing library.

Regarding the URL standard: "acceptance" pretty much depends on who you ask. It’s designed to reflect how browsers actually work, and to properly define error handling (where RFCs can be quite hand-wavy.)

Regarding URL v.s. URI: first, is it useful to have two distinct concepts? In practice, the difference doesn’t really matter to software. If that distinction is removed, we need to pick a single term. URI might be "more correct", but in practice everybody outside of IETF uses URL. See what happened with TLS: it’s been around for 15 years, but we still talk about SSL which only existed 4 years before that.

@mikedilger
Copy link
Contributor Author

Thanks. Ignore my URI/URL madness. I'll make a more concrete suggestion (hopefully pull req) in the coming days.

@SimonSapin
Copy link
Member

Related: #2

@mikedilger
Copy link
Contributor Author

After reading more than half the code and re-reading both standards, I've recognized why URL parsing needs to be this way, grouping the scheme-relative URL, rather than putting Authority and Path in the top struct... because an absolute URL needs at least a host in the authority section, and other schemes define the whole scheme-relative URL. So I'll probably just use as-is, parsing with a dummy base url and having blank fields. Closing.

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

No branches or pull requests

2 participants