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
Frame size is now 24bit. Decode exception must be adjusted #17
Conversation
@@ -238,7 +238,7 @@ | |||
it "should raise connection error on decode exception" do | |||
@conn << f.generate(SETTINGS) | |||
frame = f.generate(HEADERS.dup) | |||
frame[2] = 0.chr | |||
frame[3] = 0.chr |
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.
Hmm, are you sure? You're setting flags to 0x0..
- [0,1] = 8+16bits (length)
- [2] = type
- [3] = flags
Or, am I missing something? Also, as an aside, some of these tests could definitely use some refactoring :)
Hmm. In this code, frame is an octet string. frame[3] is type. Setting type to zero (DATA) causes an exception We should explicitly send DATA frame, rather than modify HEADERS octets. |
0f25817
to
2c196cf
Compare
Hmm, not sure about this one either. We already have a test for "error if first frame is not SETTINGS": The intent of this test was to test a decode exception - i.e. a malformed frame that contains bogus or invalid data. |
I agree. How can we craft a "malformed frame"?
|
Hmm.. There seems no validations on incoming frames in framer.rb. I might mock framer.parse to raise an error (instead of feeding crafted octets). @conn.instance_eval{@framer}.should_receive(:parse).and_raise(CompressionError.new) |
I think the wording of current test is misleading. We're testing connection-level logic in this set of tests, and framing errors should be handled elsewhere. I propose we:
Within the latter test, we can set SETTINGS with stream ID != 0. Then, independent of the above, we can add some specs (and logic) for frame decode sanity checking:
Right now we assume that we receive well-formed frames.. which is optimistic. :) |
bump.. we should probably fix this. @mad-p did my last comment make sense? |
Additional frame size fixes.