https://kotlinlang.org logo
#stdlib
Title
# stdlib
m

Marc Knaup

06/12/2019, 3:12 AM
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

natpryce

06/12/2019, 6:29 AM
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

elizarov

06/12/2019, 7:39 AM
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

natpryce

06/12/2019, 8:22 AM
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

elizarov

06/12/2019, 8:22 AM
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

natpryce

06/12/2019, 8:50 AM
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

nkiesel

06/12/2019, 7:17 PM
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?
7 Views