crossbario / autobahn-testsuite

Autobahn WebSocket protocol testsuite
https://crossbar.io/autobahn/
Apache License 2.0
973 stars 82 forks source link

Test 13 WebSocket Compression (different parameters) #112

Open mortzdk opened 4 years ago

mortzdk commented 4 years ago

Hi I'm currently working on a websocket server in C.

At this point in time I pass all tests in the testsuite including the compression tests.

One interesting bug that occured in Firefox (after I passed all tests in the testsuite) was when no parameters was send with the permessage-deflate, I was not able to decompress the message.

According to the spec:

Absence of this extension parameter in an extension negotiation response indicates that the server can receive messages compressed using an LZ77 sliding window of up to 32,768 bytes.

I'm not really sure whether some of the tests actually do test this, but if they do, the behaviour is different from the behaviour of Firefox, since I passed all tests but still failed in Firefox.

My issue was solved by choosing the default_max_client_bits to be 15 (2^15 = 32,768 bytes) if the client did not send the client_max_window_bits parameter at all.

I use zlib and before solving the issue I used the value 0 for the windowSize of inflateInit2 or simply inflateInit where no windowSize needs to be given.

I'm not sure whether this is the job of the testsuite to catch such a bug, but at least now you know of the case.