rsocket-kotlin icon indicating copy to clipboard operation
rsocket-kotlin copied to clipboard

Critical compatibility issue in Kotlin implementation due to MIME type serialization mismatch

Open akowal opened this issue 1 year ago • 0 comments

The current serialization of custom MIME types in Kotlin's RSocket implementation is not compatible with other implementations. The issue lies in the handling of the MIME type name's size during serialization and deserialization. Specifically, the Kotlin implementation directly writes the length of the MIME type name as it is: https://github.com/rsocket/rsocket-kotlin/blob/2239c5ca176694effbd803643d0179e79f76be3f/rsocket-core/src/commonMain/kotlin/io/rsocket/kotlin/frame/io/mimeType.kt#L50

Contrarily, other RSocket implementations such as Go and Java adjust the MIME type name length by decreasing it by one when writing and increasing it by one when reading:

This discrepancy makes Kotlin implementation incompatible with all other implementations.

akowal avatar Apr 26 '24 16:04 akowal