Commit Graph
1 Commits
Author SHA1 Message Date
David EvansandCory Benfield 275a907a86 Implement the beginnings of a framing parser (#614)
* Boilerplate

* Add extremely simple tests cases

* Basic literal support

* Add literal+, literal-, and binary support

* Fix backtracking

* Start some integration tests

* A few type renames

* Make the framer throwing

* Soundness

* Address some of Cory's comments

* More graceful handling or CRs and LFs

* Apple Cory suggestions part 2

* Swallow LF

* Make it all work

* Refactor

* Define LineFeedStrategy enum

* Refactor integer parsing and add frame status

* Digit constants

* Refactor adjusting frame length

* Defend against infinite size

* Fix literal bugs

* Soundness

* Add some docs

* Update Sources/NIOIMAP/Client/FramingParser.swift

Co-authored-by: Cory Benfield <lukasa@apple.com>

* Prefer () over break

* Use UInt64 where appropriate

* Implement a stepback function

* Fix FrameSatus typo

* Don't allocate 2 buffers

* Rename LiteralSubstate to LiteralHeaderState

* Use Float64

* Remove frame debugging function

* Fix empty frame logic

* Discard empty bytes

* Fix handing optional LF in a literal

* Soundness

* Remove random Darwin import

* Cory nits

* Discard when we've read over half the buffer

* Read at least 1KB before cleaning

* Soundness

* Fix precondition

Co-authored-by: Cory Benfield <lukasa@apple.com>
2021-09-15 16:38:03 +01:00