Skip to content
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

Merged
merged 1 commit into from
Jan 18, 2017

Conversation

ktoso
Copy link
Member

@ktoso ktoso commented Jan 18, 2017

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

@ktoso
Copy link
Member Author

ktoso commented Jan 18, 2017

Please review, I'll continue on top of this one with the other handlings

@akka/akka-http-team @jrudolph

@akka-ci akka-ci added validating PR that is currently being validated by Jenkins tested PR that was successfully built and tested by Jenkins and removed validating PR that is currently being validated by Jenkins labels Jan 18, 2017
@akka-ci
Copy link

akka-ci commented Jan 18, 2017

Test PASSed.

Copy link
Member

@jrudolph jrudolph left a 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(",")}")
Copy link
Member

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.

Copy link
Member Author

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
Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Member Author

@ktoso ktoso Jan 18, 2017

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)
Copy link
Member

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.

Copy link
Member Author

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()
Copy link
Member

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).

Copy link
Member Author

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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

@ktoso
Copy link
Member Author

ktoso commented Jan 18, 2017

Applied all feedback

@akka-ci akka-ci added validating PR that is currently being validated by Jenkins tested PR that was successfully built and tested by Jenkins and removed tested PR that was successfully built and tested by Jenkins validating PR that is currently being validated by Jenkins labels Jan 18, 2017
@akka-ci
Copy link

akka-ci commented Jan 18, 2017

Test PASSed.

case SettingsAckFrame ⇒
LogEntry(0, "SETA", "")
case SettingsAckFrame(s) ⇒
val acksInfo = s.map {
Copy link
Member

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.

Copy link
Member Author

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!")
Copy link
Member

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.

Copy link
Member Author

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 ⇒
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice.

@akka-ci akka-ci added validating PR that is currently being validated by Jenkins tested PR that was successfully built and tested by Jenkins and removed tested PR that was successfully built and tested by Jenkins validating PR that is currently being validated by Jenkins labels Jan 18, 2017
@akka-ci
Copy link

akka-ci commented Jan 18, 2017

Test PASSed.

Copy link
Member

@jrudolph jrudolph left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ktoso ktoso merged commit 6c542a6 into akka:master Jan 18, 2017
@ktoso
Copy link
Member Author

ktoso commented Jan 18, 2017

Thanks for reviews, writing/copying the same things for the nth time caught me off guard in some places.

@ktoso ktoso deleted the wip-table-size-setting branch January 18, 2017 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tested PR that was successfully built and tested by Jenkins
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants