We just implemented our own CBOR decoder. Let's use it in
httppeer.
Details
Details
- Reviewers
pulkit - Group Reviewers
hg-reviewers - Commits
- rHGcdb56f295b03: httppeer: use our CBOR decoder
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
Event Timeline
Comment Actions
Queued the cbor patches. I think following can improve the code more:
- Having a cborutil.decodeone() function which can make sure we only have one dcoded value and using that fn instead of decodeall()[0]
- A cborutil.encode() function to use where we don't want to do streamencode() and use that in place of b''.join() pattern
- Checking for an empty string being passed in cborutil.decodeall()[0] or cborutil.decodeone()
What do you think?
Comment Actions
I agree with all these suggestions. I also think we should teach the sansiodecoder to decode at most one item and use that functionality to build cborutil.decodeone().
FWIW one concern with going down that path is buffer over-read: if we're trying to decode a CBOR value from a stream without advancing past the end of the value, that can be difficult to do without feeding in data in small chunks. But it is doable.