Accept smaller server_max_window_bits than requested (#11394)

Motivation:

Netty will fail a handshake for the Per-Message Deflate WebSocket
extension if the server response contains a smaller
`server_max_window_bits` value than the client offered.

However, this is allowed by RFC 7692:

> A server accepts an extension negotiation offer with this parameter
> by including the “server_max_window_bits” extension parameter in the
> extension negotiation response to send back to the client with the
> same or smaller value as the offer.

Modifications:

- Allow the server to respond with a smaller value than offered.
- Change the unit tests to test for this.

Result:

The client will not fail when the server indicates it is using a
smaller window size than offered by the client.
This commit is contained in:
ktqco 2021-06-18 10:45:32 +01:00 committed by Norman Maurer
parent a36d5312c5
commit e59722037c
2 changed files with 2 additions and 2 deletions

View File

@ -183,7 +183,7 @@ public final class PerMessageDeflateClientExtensionHandshaker implements WebSock
}
if ((requestedServerNoContext && !serverNoContext) ||
requestedServerWindowSize != serverWindowSize) {
requestedServerWindowSize < serverWindowSize) {
succeed = false;
}

View File

@ -90,7 +90,7 @@ public class PerMessageDeflateClientExtensionHandshakerTest {
parameters = new HashMap<>();
parameters.put(CLIENT_MAX_WINDOW, "12");
parameters.put(SERVER_MAX_WINDOW, "10");
parameters.put(SERVER_MAX_WINDOW, "8");
parameters.put(CLIENT_NO_CONTEXT, null);
parameters.put(SERVER_NO_CONTEXT, null);