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

KTOR-2991 Do not treat semicolon as separator in Netty engine. #2581

Merged
merged 1 commit into from
Aug 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public abstract class NettyApplicationRequest(
) : BaseApplicationRequest(call), CoroutineScope {

public final override val queryParameters: Parameters = object : Parameters {
private val decoder = QueryStringDecoder(uri)
private val decoder = QueryStringDecoder(uri, HttpConstants.DEFAULT_CHARSET, true, 1024, true)
override val caseInsensitiveName: Boolean get() = true
override fun getAll(name: String) = decoder.parameters()[name]
override fun names() = decoder.parameters().keys
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -785,6 +785,28 @@ abstract class HttpServerTestSuite<TEngine : ApplicationEngine, TConfiguration :
}
}

@Test
fun queryParameterContainingSemicolon() {
createAndStartServer {
handle {
assertEquals("01;21", call.request.queryParameters["code"])
call.respond(HttpStatusCode.OK)
}
}

withUrl(
"/",
{
url {
parameters.urlEncodingOption = UrlEncodingOption.NO_ENCODING
parameters.append("code", "01;21")
}
}
) {
assertEquals(200, status.value)
}
}

private data class TestData(
val name: String
) : AbstractCoroutineContextElement(TestData) {
Expand Down