Ktor Version and Engine Used (client or server and name)
Tested with Ktor Client Common 1.3.70-eap-42, but bug is present in current stable version as well.
Describe the bug
The URLParser (used by the URLBuilder) does not support schemes with numbers, plus
("+"), period ("."), or hyphen ("-") characters.
This is not according to the RFC 3986 specification: https://tools.ietf.org/html/rfc3986#page-17
The findScheme function only handles schems with letters and when no scheme can be parsed it will default to http as scheme and localhost as host.
To Reproduce
Execute
val urlBuilder = URLBuilder(urlString = "test-scheme123://ktor.io/index.html")
println("Test URL: ${urlBuilder.buildString()}")
Expected behavior
The URLParser should correctly handle these types of URL schemes, and in this case it should print the initial URL that was passed to the URLBuilder.
Ktor Version and Engine Used (client or server and name) Tested with Ktor Client Common 1.3.70-eap-42, but bug is present in current stable version as well.
Describe the bug The URLParser (used by the URLBuilder) does not support schemes with numbers, plus ("+"), period ("."), or hyphen ("-") characters. This is not according to the RFC 3986 specification: https://tools.ietf.org/html/rfc3986#page-17
The
findScheme
function only handles schems with letters and when no scheme can be parsed it will default tohttp
as scheme andlocalhost
as host.To Reproduce Execute
This will print
Expected behavior The URLParser should correctly handle these types of URL schemes, and in this case it should print the initial URL that was passed to the URLBuilder.