Project

General

Profile

WebSocket component: to make it more complient with rfc6455

Igor Khomenko
Added over 1 year ago

Hi guys,

Recently I played with https://www.nativescript.org development.

I used https://github.com/NathanaelA/nativescript-websockets lib to connect to Tigase but unfortunately spent almost one day to figure out why it was not working (was not able to even open WS connection)

Then after some deep debugging I realized that this lib sends the Connection: upgrade header when handshake. But Tigase expects it as Connection: Upgrade here https://tigase.tech/projects/tigase-server/repository/revisions/master/entry/server/src/main/java/tigase/server/websocket/WebSocketXMPPIOService.java#L367

I tried to modify the nativescript-websockets lib but then realized it uses another lib inside to cope with WS - PocketSocket and it's actually it sets this header in lower case format: https://github.com/zwopple/PocketSocket/blob/master/PocketSocket/PSWebSocketDriver.m#L220

My first thought was that it's a bug with the PocketSocket lib.

But then I investigated the rfc6455 and found the following rule in 4.2.1 section:

  1. A |Connection| header field that includes the token "Upgrade",

treated as an ASCII case-insensitive value.

https://tools.ietf.org/html/rfc6455#section-4.2.1

So it seems that clients can send this header in any format: Upgrade or upgrade.

Are you able to modify Tigase code a little bit and make it more complient with the spec?

Thank you


Replies (1)

Avatar?id=6023&size=32x32

Added by Artur Hefczyc TigaseTeam over 1 year ago

Thank you very much for detailed information and the in-depth research on the problem. I have opened a bug report for this: #6481. Please "watch" the bug report to get automated updated on the resolution progress.

    (1-1/1)