Return parsed packets #11

wants to merge 4 commits into from

2 participants


This changes Parser#try_parse to return an array of the parsed packets after parsing.

I found it very useful when testing the responses of my SPDY server.
The return value should probably be adjusted to nil in the return statements above it in order to be consistent.

What are your thoughts?


First, it looks like there are two distinct commits here.. one to reuse inflating code, and another for the return types.

  • inflating: looks good
  • returning packets: I can see the convenience factor, but I wonder if this just muddies the water down the road. The parser is built with the callback semantics in mind, so returning the parsed packets is an unexpected side effect - not something I would want others to use, since that's not the interface we're after.

Yup, I see. Leaving it out makes the parser API much simpler as well, as the user is not concerned with the BinData stuff at all. It was meant as a hack for testing, maybe it should stay that way.

I will open another pull for the inflate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment