Correct handling of unsigned HTTP/2 SETTINGS values - #713
Conversation
a358e5b to
c79252c
Compare
|
@arturobernalg I am honestly not sure I understand the problem you are trying to solve here. What is the problem with the setting value being represented by signed int? What is important that for any kind of arithmetic operations it need to be converted to long with Integer#toUnsignedLong |
@ok2c I conflated the signed representation with the unsigned interpretation; I’ll keep the raw 32-bit value as int and only use Integer.toUnsignedLong where numeric comparison or arithmetic is required. |
67efe43 to
1ed120d
Compare
9a2dda8 to
620ac68
Compare
ok2c
left a comment
There was a problem hiding this comment.
@arturobernalg Exactly! Looks good now.
Please cherry-pick to 5.4.x
@ok2c done |
RFC 9113 defines SETTINGS values as unsigned 32-bit integers. Values with the high bit set are currently read as negative Java
intvalues and rejected forSETTINGS_HEADER_TABLE_SIZE,SETTINGS_MAX_CONCURRENT_STREAMS, andSETTINGS_MAX_HEADER_LIST_SIZE.Accept the full unsigned wire range for these settings and bound values above
Integer.MAX_VALUEto the internalH2Configrepresentation.SETTINGS_INITIAL_WINDOW_SIZEis intentionally unchanged: values above2^31-1continue to produceFLOW_CONTROL_ERROR.SETTINGS_MAX_FRAME_SIZEalso retains its RFC-defined range.RFC 9113 §2.2, §6.5.1 and §6.5.2.