Skip to content

Conversation

@robert-s-ubi
Copy link
Contributor

Description

Add a reimplementation of the WebSocket Per-Message Deflate extension written from scratch for full RFC 7962 compliance, with the following over the existing implementation:

  • compliant extension parameters negotiation handling
  • default operation with context takeover works
  • fragmented messages are handled correctly (either all fragments are compressed/decompressed or none)
  • clears RSV1 after decompressing to remove the compression mark
  • produces the result specified in RFC 7962 section 7.2.3.4
  • produces the result specified in RFC 7962 section 7.2.3.6
  • uses the extension common name registered for RFC 7962
  • has an additional optional constructor parameter "maxFrameSize" to ensure the limit is not exceeded while decompressing already
  • has an additional API "getCompressionRatio()" to get the effective compression ratio (over all payloads compressed and decompressed)

Otherwise, it is fully API compatible with the old implementation.

For now, the new implementation lives side by side with the old one, and is named "WebSocketPerMessageDeflateExtension".

Add RFC 7962 tests for the new implementation, to validate it produces the expected results for all examples from RFC 7962 section 7.2.3.

Add a copy of the unit tests for the old implementation, which verifies the new implementation works the same, except for fixed issues and different defaults.

Related Issue

This fixes issue #1496

Motivation and Context

The existing implementation was broken in multiple ways and not fully RFC 7962 compliant. The new implementation was written to fix all that.

How Has This Been Tested?

Tested with adapted existing tests for the existing implementation, new RFC 7962 compliance tests (all part of this PR), and also within the Java-OCA-OCPP library, and an integration test which creates an OCPP client and server and connects these on the local machine.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Add a reimplementation of the WebSocket Per-Message Deflate extension
written from scratch for full RFC 7962 compliance, with the following
over the existing implementation:

- compliant extension parameters negotiation handling
- default operation with context takeover works
- fragmented messages are handled correctly (either all fragments are
  compressed/decompressed or none)
- clears RSV1 after decompressing to remove the compression mark
- produces the result specified in RFC 7962 section 7.2.3.4
- produces the result specified in RFC 7962 section 7.2.3.6
- uses the extension common name registered for RFC 7962
- has an additional optional constructor parameter "maxFrameSize" to
  ensure the limit is not exceeded while decompressing already
- has an additional API "getCompressionRatio()" to get the effective
  compression ratio (over all payloads compressed and decompressed)

Otherwise, it is fully API compatible with the old implementation.

For now, the new implementation lives side by side with the old one, and
is named "WebSocketPerMessageDeflateExtension".

Add RFC 7962 tests for the new implementation, to validate it produces
the expected results for all examples from RFC 7962 section 7.2.3.

Add a copy of the unit tests for the old implementation, which verifies
the new implementation works the same, except for fixed issues and
different defaults.
@robert-s-ubi
Copy link
Contributor Author

If desired, I could also make the new implementation replace the old one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant