Skip to content

Commit c22735c

Browse files
authored
Release 2.3.12 (#4088)
1 parent b5d9213 commit c22735c

File tree

18 files changed

+141
-85
lines changed

18 files changed

+141
-85
lines changed

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ blank_issues_enabled: false
22
contact_links:
33
- name: Create
44
url: https://youtrack.jetbrains.com/newIssue?project=KTOR
5-
about: Please report any new issue using youtrack
5+
about: Please report any new issues to the JetBrains YouTrack

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
# 2.3.12
2+
> Published 20 June 2024
3+
4+
### Bugfixes
5+
* NoSuchMethodError when using coroutines 1.9.0-RC ([KTOR-7054](https://youtrack.jetbrains.com/issue/KTOR-7054))
6+
* Server: Content-Type header for static js, css and svg resources misses charset ([KTOR-6655](https://youtrack.jetbrains.com/issue/KTOR-6655))
7+
* Embedded Linux device without iso-8859-1 and UTF-16 cannot use ktor-network ([KTOR-7016](https://youtrack.jetbrains.com/issue/KTOR-7016))
8+
9+
### Improvements
10+
* Update netty to 4.1.111.Final ([KTOR-7094](https://youtrack.jetbrains.com/issue/KTOR-7094))
11+
* Update netty due to CVE-2024-29025 ([KTOR-7014](https://youtrack.jetbrains.com/issue/KTOR-7014))
12+
* Update dependency on swagger ([KTOR-7019](https://youtrack.jetbrains.com/issue/KTOR-7019))
13+
114
# 2.3.11
215
> Published 8 May 2024
316

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ ktor.ide.jvmAndCommonOnly=true
1010
kotlin.code.style=official
1111

1212
# config
13-
version=2.3.10
13+
version=2.3.12
1414

1515
# gradle
1616
org.gradle.daemon=true

gradle/libs.versions.toml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ serialization-version = "1.5.1"
77
validator-version = "0.8.0"
88
ktlint-version = "3.15.0"
99

10-
netty-version = "4.1.106.Final"
11-
netty-tcnative-version = "2.0.62.Final"
10+
netty-version = "4.1.111.Final"
11+
netty-tcnative-version = "2.0.65.Final"
1212

13-
jetty-version = "9.4.53.v20231009"
14-
jetty-jakarta-version = "11.0.20"
13+
jetty-version = "9.4.54.v20240208"
14+
jetty-jakarta-version = "11.0.21"
1515
jetty-alpn-api-version = "1.1.3.v20160715"
1616
jetty-alpn-boot-version = "8.1.13.v20181017"
17-
jetty-alpn-openjdk8 = "9.4.53.v20231009"
17+
jetty-alpn-openjdk8 = "9.4.54.v20240208"
1818

19-
tomcat-version = "9.0.85"
19+
tomcat-version = "9.0.89"
2020
tomcat-jakarta-version = "10.1.18"
2121

2222
apache-version = "4.1.5"
@@ -30,10 +30,10 @@ gson-version = "2.10.1"
3030
jackson-version = "2.16.1"
3131

3232
junit-version = "4.13.2"
33-
slf4j-version = "2.0.11"
33+
slf4j-version = "2.0.13"
3434
logback-version = "1.3.14"
3535

36-
dropwizard-version = "4.2.25"
36+
dropwizard-version = "4.2.26"
3737
micrometer-version = "1.12.4"
3838

3939
jansi-version = "2.4.1"
@@ -44,8 +44,8 @@ mockk-version = "1.13.5"
4444
java-jwt-version = "4.4.0"
4545

4646
jwks-rsa-version = "0.22.1"
47-
mustache-version = "0.9.11"
48-
freemarker-version = "2.3.32"
47+
mustache-version = "0.9.13"
48+
freemarker-version = "2.3.33"
4949
pebble-version = "3.2.2"
5050
velocity-version = "2.3"
5151
velocity-tools-version = "3.1"
@@ -63,7 +63,7 @@ yamlkt-version = "0.13.0"
6363

6464
swagger-codegen-version = "3.0.41"
6565
swagger-codegen-generators-version = "1.0.38"
66-
swagger-parser-version = "2.1.19"
66+
swagger-parser-version = "2.1.22"
6767

6868
[libraries]
6969
kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin-version" }

ktor-http/common/src/io/ktor/http/FileContentType.kt

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,34 @@ private val extensionsByContentType: Map<ContentType, List<String>> by lazy {
6565
internal fun List<ContentType>.selectDefault(): ContentType {
6666
val contentType = firstOrNull() ?: ContentType.Application.OctetStream
6767
return when {
68-
contentType.contentType == "text" && contentType.charset() == null -> contentType.withCharset(Charsets.UTF_8)
68+
contentType.match(ContentType.Text.Any) -> contentType.withCharsetUTF8IfNeeded()
69+
contentType.match(ContentType.Image.SVG) -> contentType.withCharsetUTF8IfNeeded()
70+
contentType.matchApplicationTypeWithCharset() -> contentType.withCharsetUTF8IfNeeded()
6971
else -> contentType
7072
}
7173
}
7274

75+
private fun ContentType.matchApplicationTypeWithCharset(): Boolean {
76+
if (!match(ContentType.Application.Any)) return false
77+
78+
return when {
79+
match(ContentType.Application.Atom) ||
80+
match(ContentType.Application.JavaScript) ||
81+
match(ContentType.Application.Rss) ||
82+
match(ContentType.Application.Xml) ||
83+
match(ContentType.Application.Xml_Dtd)
84+
-> true
85+
86+
else -> false
87+
}
88+
}
89+
90+
private fun ContentType.withCharsetUTF8IfNeeded(): ContentType {
91+
if (charset() != null) return this
92+
93+
return withCharset(Charsets.UTF_8)
94+
}
95+
7396
internal fun <A, B> Sequence<Pair<A, B>>.groupByPairs() = groupBy { it.first }
7497
.mapValues { e -> e.value.map { it.second } }
7598

ktor-http/common/src/io/ktor/http/Mimes.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,7 @@ private val rawMimes: String
428428
.jpgv,video/jpeg
429429
.jpm,video/jpm
430430
.jps,image/x-jps
431+
.js,text/javascript
431432
.js,application/javascript
432433
.json,application/json
433434
.jut,image/jutvision

ktor-io/linux/src/CharsetLinux.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import platform.iconv.*
1010
import platform.posix.*
1111

1212
public actual object Charsets {
13-
public actual val UTF_8: Charset = CharsetIconv("UTF-8")
14-
public actual val ISO_8859_1: Charset = CharsetIconv("ISO-8859-1")
15-
internal val UTF_16: Charset = CharsetIconv(platformUtf16)
13+
public actual val UTF_8: Charset by lazy { CharsetIconv("UTF-8") }
14+
public actual val ISO_8859_1: Charset by lazy { CharsetIconv("ISO-8859-1") }
15+
internal val UTF_16: Charset by lazy { CharsetIconv(platformUtf16) }
1616
}
1717

1818
internal actual fun findCharset(name: String): Charset {

ktor-io/mingwX64/src/CharsetMingw.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import platform.iconv.*
1010
import platform.posix.*
1111

1212
public actual object Charsets {
13-
public actual val UTF_8: Charset = CharsetIconv("UTF-8")
14-
public actual val ISO_8859_1: Charset = CharsetIconv("ISO-8859-1")
15-
internal val UTF_16: Charset = CharsetIconv(platformUtf16)
13+
public actual val UTF_8: Charset by lazy { CharsetIconv("UTF-8") }
14+
public actual val ISO_8859_1: Charset by lazy { CharsetIconv("ISO-8859-1") }
15+
internal val UTF_16: Charset by lazy { CharsetIconv(platformUtf16) }
1616
}
1717

1818
private class CharsetIconv(name: String) : Charset(name) {

ktor-network/jvmAndNix/src/io/ktor/network/sockets/Sockets.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,11 @@ public interface ABoundSocket {
6666
*/
6767
public interface Acceptable<out S : ASocket> : ASocket {
6868
/**
69-
* accepts socket connection or suspends if none yet available.
69+
* Suspends until a connection is available and returns it or throws if something
70+
* goes wrong.
71+
*
7072
* @return accepted socket
73+
* @throws IOException
7174
*/
7275
public suspend fun accept(): S
7376
}

ktor-server/ktor-server-plugins/ktor-server-swagger/jvm/src/io/ktor/server/plugins/swagger/SwaggerConfig.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public class SwaggerConfig {
1313
/**
1414
* Specifies a Swagger UI version to use.
1515
*/
16-
public var version: String = "4.14.0"
16+
public var version: String = "5.17.12"
1717

1818
/**
1919
* Specifies a URL for a custom CSS applied to a Swagger UI.

0 commit comments

Comments
 (0)