Skip to content

Commit

Permalink
KTOR-2991 Do not treat semicolon as separator in Netty engine.
Browse files Browse the repository at this point in the history
This fix unifies behavior with other engines
  • Loading branch information
rsinukov committed Aug 16, 2021
1 parent 10912a0 commit 1d5633d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
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,25 @@ 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")
}
}) {
Assert.assertEquals(200, status.value)
}
}

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

0 comments on commit 1d5633d

Please sign in to comment.