Skip to content

Commit b9520e8

Browse files
committed
Limit enable-push role validation to received settings
1 parent f95a7db commit b9520e8

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/h2/settings.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -334,19 +334,19 @@ def _validate_setting(
334334
setting: SettingCodes | int,
335335
value: int,
336336
*,
337-
client: bool = False,
337+
client: bool | None = None,
338338
) -> ErrorCodes:
339339
"""
340340
Confirms that a specific setting has a well-formed value. If the setting is
341341
invalid, returns an error code. Otherwise, returns 0 (NO_ERROR).
342342
343-
If ``client`` is true, the setting originated from a client endpoint.
343+
If ``client`` is set, the setting originated from a peer with that role.
344344
"""
345345
if setting == SettingCodes.ENABLE_PUSH:
346346
# RFC 9113 section 6.5.2: "A client MUST treat receipt of a
347347
# SETTINGS frame with SETTINGS_ENABLE_PUSH set to 1 as a connection
348348
# error (Section 5.4.1) of type PROTOCOL_ERROR."
349-
if value not in (0, 1) or (not client and value != 0):
349+
if value not in (0, 1) or (client is False and value != 0):
350350
return ErrorCodes.PROTOCOL_ERROR
351351
elif setting == SettingCodes.INITIAL_WINDOW_SIZE:
352352
if not 0 <= value <= 2147483647: # 2^31 - 1

0 commit comments

Comments
 (0)