Migrating 1.2.4 → 1.3.0

Estimated reading time: 4 minutes

1.3.0

  • ktor client proxy support
  • Eliminated kotlinx.io dependency
  • Fixed server identity compression handling: keep original content length
  • Fixed handling GET requests with body #1302
  • Fixed curl request with empty body
  • Added iOS url session configuration
  • Fixed CIO engine no longer sends port in “Host” header #1295
  • Add INTRINSIC value to TLS signature algorithms
  • Introduced ability to send string in request body
  • Improved client and server typeOf support with kotlinx.serialization
  • Gradle 5.4.1+ with newer metadata
  • Improved exceptions handling in client and server on Android
  • Added missing TLS parameters and relaxed TLS parsing to ignore unsupported features
  • Improved session diagnostics #1368
  • Fixed hookRequests in test engine #1300
  • Deprecate java.time related API and related cleanup (for future kotlin.time support)
  • Restricted CIO HTTP headers parser
  • Introduced header name and value validation
  • Fixed must-revalidate on the request side in ktor client #1406
  • Fixed OkHttp client resource cleanup on close
  • Added watchos/tvos native targets
  • Fixed content truncation at native and JS targets
  • Fixed server’s If-Range header parsing to avoid crash at date parsing #1377
  • Fixed server’s conditional headers processing
  • Reduced required JDK version for DefaultHeaders server feature
  • Fixed client hanging due to exception in response pipeline
  • Replaced HttpClientJvmEngine to HttpClientEngineBase that is now common for all platforms (affects only custom client engines)
  • Fixed hierarchy of execution and call contexts in clients that allows to properly handle request lifetime using execution context.
  • Optimize JS module import time #1464
  • Upgraded versions of Netty, Jetty and Tomcat implementations
  • Added Pebble template engine #1374
  • Introduced localPort route that is always tied to actual socket port #1392
  • Fixed cookie expiration date parsing #1390
  • Server authentication feature’s phases are now public #1160
  • Fixed auth header resending after redirect #1467
  • TCP half-close made optional for CIO client engine and disabled by default. #1456
  • Apache client random timeouts fixed
  • Fixed locale-dependant code #1491
  • Fixed unclosed websocket channels if cancelled too early
  • Improved ktor-client-mock engine to be thread safe #1505
  • Fixed client cookies logging #1506
  • Fixed multiple application stop events in test engine #1498
  • Fixed CIO ActorSelectorManager to not spin due to cancelled keys (affects both CIO client and server)
  • Made default auth validate functions fail to force users to implement them
  • Introduced test client instance in the test server
  • Fixed various server and client engines to return null for missing headers rather than empty list
  • Introduced support for json structures in client and server #1519
  • Fixed locale-dependat code #1491
  • kotlinx.coroutines 1.3.3
  • Full changelog: https://github.com/ktorio/ktor/compare/1.2.4...1.3.0
  • API Documentation: https://api.ktor.io/1.3.0

Published 14 Jan 2020 (1.3.0)

Version bumps:

  • Kotlin 1.3.50 -> 1.3.61
  • kotlinx.coroutines 1.3.0 -> 1.3.3
  • Dropwizard: 3.2.4 -> 4.1.0
  • Tomcat: 9.0.10 -> 9.0.29
  • Jetty: 9.4.22.v20191022 -> 9.4.24.v20191120
  • Netty: 4.1.37.Final -> 4.1.43.Final
  • kotlinx.io -> 0.1.14 -> none

Breaking changes:

  • kotlinx.io dependency has been removed, replace imports:
    • import kotlinx.io. -> import io.ktor.utils.io.
    • import kotlinx.coroutines.io. -> import io.ktor.utils.io.
  • No binary compatibility with 1.2.x.
  • Incompatible Gradle metadata version (requires 5.4.1+ for MPP).
  • It was dangerous to forget call HttpResponse.close, so we cleaned it’s API:
    • HttpResponse isn’t Closeable anymore: no need to close it, no resource leaks
    • HttpResponse is in-memory by default
    • Introduced HttpStatement: new primitive for streaming and partial load
  • Web socket session send function now throws CancellationException instead of ClosedSendChannelException.

Known issues:

  • Netty HTTP/2 push sometimes get rejected
  • Running iOS and native clients on non-main worker is still not supported
  • JS engine may trigger CORS preflight (#1533)