What about moving `Url` from ktor.http to stdlib? ...
# stdlib
m
What about moving
Url
from ktor.http to stdlib? šŸ¤” • it's very commonly needed • it's for more than HTTP or even networking • Ktor is an implementation detail - could also be another HTTP client • when using different libraries (networking and other) they all use different
Url
classes because there's no common denominator
šŸ‘ 3
😮 1
n
A URI class would be very useful, even for developers on the JVM (neither the the standard URL nor URI class implement encoding of paths correctly)
e
The problem is that standards on what ā€œproper encodingā€ and what is a ā€œcorrect URL/URIā€ change from time to time. Adding these kind of things to stdlib in not the best idea.
Also, you’d want this class to be useful in practical situations, which is often in opposition to being ā€œstandards compliantā€, and there you have too much domain-specific design freedom.
n
Hmmm... the URI class gets path encoding/decoding wrong and therefore cannot be used with real services that are out there on the web. Encoding/decoding of hierarchical URI paths was specified in the late ā€˜90s
e
so what class that does it right you use?
Also when you talk about ā€œusing in real servicesā€, then what kind of use-cases you have in mind? What you should be able to do with them? (Note that we are talking about stdlib, not ktor here).
n
There are a few UrlBuilder / UriBuilder classes I’ve used. As long as you use them to build string representations of the URI and never pass them to the standard URI and URL classes you can get away with it
There’s one called UriNE šŸ™„
And on the parsing side, HTTP4k parses incoming URIs correctly. (Undertow did not when I last looked at it, for example)
n
I only found https://sourceforge.net/projects/urin/ but not "UriNE". Is that the one you were talking about? And what are examples of wrong encodings in the URI class?