ktorio / ktor

Framework for quickly creating connected applications in Kotlin with minimal effort
https://ktor.io
Apache License 2.0
13.05k stars 1.07k forks source link

[ktor-websockets] Upgrade header not case insensitive #186

Closed Redrield closed 7 years ago

Redrield commented 7 years ago

In the websockets feature, specifically at https://github.com/Kotlin/ktor/blob/master/ktor-features/ktor-websockets/src/org/jetbrains/ktor/websocket/WebSocketUpgrade.kt#L22, the upgrade header is defined as requiring a value of 'websocket' exactly. This violates the terms set in section 4.2.1 of RFC 6455, which states that

An |Upgrade| header field containing the value "websocket", treated as an ASCII case-insensitive value.

This can be solved by comparing header values with ignoreCase as true.

orangy commented 7 years ago

Fixed