-
Notifications
You must be signed in to change notification settings - Fork 596
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
+ht2 #776 handle incoming SETTINGS_HEADER_TABLE_SIZE #790
Conversation
Please review, I'll continue on top of this one with the other handlings @akka/akka-http-team @jrudolph |
Test PASSed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, looking good. We don't really test so far that the hpack encoder actually uses the setting but I think that's fine for now. Maybe add a new ticket to add that test later on.
case SettingsAckFrame ⇒ | ||
LogEntry(0, "SETA", "") | ||
case SettingsAckFrame(s) ⇒ | ||
LogEntry(0, "SETA", s"Acked settings: ${s.mkString(",")}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use the same settingsInfo
format as above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right, done
* The size of a frame payload is limited by the maximum size that a receiver advertises in the SETTINGS_MAX_FRAME_SIZE setting. | ||
* This setting can have any value between 214 (16,384) and 224-1 (16,777,215) octets, inclusive. | ||
*/ | ||
final val MinFrameSize = Math.pow(2, 14).toInt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe put the integer number in the code and write the2^14
in a comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I just discovered scaladoc understand ^12^ as 12
@@ -100,7 +100,7 @@ private[http2] class Http2FrameParsing(shouldReadPreface: Boolean) extends ByteS | |||
if (payload.hasRemaining) | |||
throw new Http2Compliance.IllegalPayloadInSettingsAckFrame(payload.remainingSize, s"SETTINGS ACK frame MUST NOT contain payload (spec 6.5)!") | |||
|
|||
SettingsAckFrame | |||
SettingsAckFrame(Nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's the point, where we would have needed to keep track of the outgoing settings to put them in here again. Maybe add that in a comment if we decide to allow dynamic setting updates later on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point adding
pending | ||
sendSETTING(SettingIdentifier.SETTINGS_HEADER_TABLE_SIZE, Math.pow(2, 15).toInt) // 32768, valid value (between 2^14 and 2^14 - 1) | ||
|
||
expectSettingsAck() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a TODO here that we'd like to check that the setting was actually applied (which is somewhat complicated, fill the table, then new setting, then check that evicted table entries don't end up here any more).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added todo, though I assumed the hpack side of things is taken care of by the current impl, but yeah have not really checked this.
def expectDecodedResponseHEADERSPairs(streamId: Int, endStream: Boolean = true): Seq[(String, String)] = { | ||
val headerBlockBytes = expectHeaderBlock(streamId, endStream) | ||
decodeHeaders(headerBlockBytes) | ||
} | ||
|
||
val encoder = new Encoder(HeaderDecompression.maxHeaderTableSize) | ||
val encoder = new Encoder(Http2Protocol.InitialMaxHeaderTableSize) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
2c3cbe8
to
e1772de
Compare
Applied all feedback |
Test PASSed. |
case SettingsAckFrame ⇒ | ||
LogEntry(0, "SETA", "") | ||
case SettingsAckFrame(s) ⇒ | ||
val acksInfo = s.map { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you create a method to be reused with the above? In case we want to change the format later on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
def validateMaxFrameSize(value: Int): Unit = { | ||
import Http2Protocol.MinFrameSize | ||
import Http2Protocol.MaxFrameSize | ||
if (value < MinFrameSize) throw new Http2ProtocolException(ErrorCode.FRAME_SIZE_ERROR, s"MAX_FRAME_SIZE MUST NOT be < than $MinFrameSize, attempted setting to: $value!") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
6.5.2:
Values outside this range MUST be treated as a connection error
(Section 5.4.1) of type PROTOCOL_ERROR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right thanks for the catch, snuck in here though it was meant to be in next PR with tests I guess.
|
||
case e: Http2Compliance.IllegalHttp2FrameSize ⇒ | ||
pushGOAWAY(FRAME_SIZE_ERROR) | ||
case e: Http2Compliance.Http2ProtocolException ⇒ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice.
e1772de
to
2274150
Compare
Test PASSed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks for reviews, writing/copying the same things for the nth time caught me off guard in some places. |
Minimal changes to get the settings handling rolling, handle incoming SETTINGS_HEADER_TABLE_SIZE. Not handling outgoing, since we don't send them anyway.
The Rendering stage I'd like to keep, at least for now, since the Data rendering there will be nice to impl there. I'm not so very keen on making it a statefulMapConcat for now, we can later if indeed looks good?
Resolves #776