The enforcer throws an InvalidFrameException if the client sends compressed frames. Therefore the frames do not get throttled and the backend continues to receive the frames.
This occurs during the testcase WebSocketBasicTestCase added with https://github.com/wso2/product-microgateway/pull/2663 when the line WebSocketClientCompressionHandler.INSTANCE, in integration/test-integration/src/test/java/org/wso2/choreo/connect/tests/util/websocket/WsClient.java is not commented.
When converting into separate frame, the library also validates whether they are regular frames or compressed (RSV1 set to true).
The compressed frames cannot be handled unless the correct extension is set (he "permessage-deflate" Extension).
The library currently in use and the netty.io expect the negotiation of the extension (the extension that could validate compressed frames) to be done during the handshake. Therefore, setting the extension is done only by using private methods.
Possible workarounds
get the frame count batched at router side
decompress the frames at router side (but then we might be breaking the protocol)
sending the frames one at a time to the enforcer
consider a batched set of frames as one frame when getting the throttle count
@VirajSalaka I am not sure if the first three above are possible. Kept them as a note.
References
"PMCEs use the RSV1 bit of the WebSocket frame header to indicate whether a message is compressed or not so that an endpoint can choose not to compress messages with incompressible contents." https://datatracker.ietf.org/doc/html/rfc7692#section-1
Description:
Error
Due to
asServer
orasClient
methodsSteps to reproduce:
This occurs during the testcase
WebSocketBasicTestCase
added with https://github.com/wso2/product-microgateway/pull/2663 when the lineWebSocketClientCompressionHandler.INSTANCE,
inintegration/test-integration/src/test/java/org/wso2/choreo/connect/tests/util/websocket/WsClient.java
is not commented.Affected Product Version:
Environment details (with versions):
Optional Fields
Related Issues:
Suggested Labels:
Suggested Assignees: