Since Safari 13.0 release, webkit starts to truncate websocket's payload to 4092 bytes when 'x-webkit-deflate-frame' extension is used.
The issue is fairly easy to reproduce - just send to a websocket any data whose compressed size is 5kb or more.
Moreover, the websocket (most likely the deflator component) on the browser side also gets 'corrupted' once a large message is sent. This leads to a 'Failed to compress frame' error in console on subsequent attempts to send more messages (even small messages) to the socket.
This behavior is only reproducible when 'x-webkit-deflate-frame' extension enabled.
If server rejects the extension - then browser behaves correctly and the payload does not get truncated, but obviously the compression is not used in this case.
Safari 12 does not have this issue. In Safari 12 the 'x-webkit-deflate-frame' extension behaves as expected and large payload does not get truncated.
Thank you for the report!
Do you have a live website that we could reproduce this?
I wasn't able to find a public working websocket server that supports 'permessage-deflate' extension.
But I created a simple server on java to reproduce the issue:
1) Clone it from https://github.com/vlsorokin/websocket-sandbox
2) Run server
> mvn compile exec:java
3) To run client open this jsfiddle in Safari 13: http://jsfiddle.net/sorrro/8b3yawod/
4) Click - Connect, Send short text, Send large text, Send short text
This will send to a websocket a random string of 10 characters, then a random string of 10,000 characters, then 10 characters again
5) You will notice an error in console saying: 'Failed to compress frame'
6) Server logs will indicate that the server has not received less than 10,000 characters
7) If you inspect traffic with Wireshark you may notice that in Safari 13, a large frame gets truncated to 4092 bytes and the second short message does not get sent.
At the same time, these steps work fine in Chrome.
Thank you. More direct steps to reproduce would help (it's unlikely that anyone here has JDK installed), but we can probably figure it out.
Sadly, we had a test for deflate fail for a long time:
../OpenSource/LayoutTests/platform/win/TestExpectations:3177:http/tests/websocket/tests/hybi/deflate-frame-parameter.html [ Failure ]
../OpenSource/LayoutTests/platform/ios/TestExpectations:2886:# <rdar://problem/33630526> http/tests/websocket/tests/hybi/deflate-frame-parameter.html is failing on iOS 11
../OpenSource/LayoutTests/platform/ios/TestExpectations:2887:http/tests/websocket/tests/hybi/deflate-frame-parameter.html [ Failure ]
../OpenSource/LayoutTests/platform/mac/TestExpectations:1569:[ HighSierra+ ] http/tests/websocket/tests/hybi/deflate-frame-parameter.html [ Failure ]
../OpenSource/LayoutTests/platform/wincairo/TestExpectations:972:http/tests/websocket/tests/hybi/deflate-frame-parameter.html [ Failure ]
There is nothing special in that java websocket server (I shared it to have a complete working example)
I.e. any server that supports `x-webkit-deflate-frame` extension should be enough, so hopefully you will be able to reproduce the bug with your own server (just make sure you use Safari 13 and `x-webkit-deflate-frame` extension is enabled).
minor correction: I wrote "permessage-deflate extension" in my previous comment, but I meant "x-webkit-deflate-frame extension" (which is default in Safari)
Any news on the status of this? Does it affect any other browser?
Fabrizio, as far as I'm aware it only affects Safari 13 (Safari 13.0.2 included), but on both macOS and iOS (and probably ipadOS).
I can repro the failure with Volodymyr repro case.
Failure happens after sending 32kb roughly.
Reverting https://trac.webkit.org/changeset/246573 fixes the issue in that specific case.
Created attachment 384131 [details]
We have force-disabled support for "x-webkit-deflate-frame" extension on the server side. This seems to work around the problem for the time being.
*** Bug 204237 has been marked as a duplicate of this bug. ***
Comment on attachment 384131 [details]
Clearing flags on attachment: 384131
Committed r252847: <https://trac.webkit.org/changeset/252847>
All reviewed patches have been landed. Closing bug.