clj-commons / clj-commons/gloss
compile-frame with pre-decoder method
- Dominant language
- Clojure
- Stars
- 486
- Forks
- 53
- PR merge metrics
- No merged PRs in 30d
Description
Hi Zach,
Currently compile-frame supports pre-encoder and post-decoder methods to manipulate the data-structure before/after use with a codec.
I'm currently using a third scenario - a pre-decoder method which manipulates the ByteBuffer being passed to a codec before decoding.
This is useful to me, because the RFC-5322 spec supports un-folding of headers before parsing, and I do that pre-decode.
A different solution would be to have a look-ahead style String codec which interpreted some byte sequences "\r\n\ " and "'\r\n\t" as simple space characters, but that seems more complicated, particularly as those byte sequences are super-sets of the "\r\n" delimiter.
More information here:
http://derek.troywest.com/articles/by-example-gloss/#gloss-extension
I could just parse my ByteBuffers prior to using the codec, but it seemed useful to append this transform method to the codec itself.
Again, I'm happy to supply a pull-request if you think it suitable.
Ta,
Derek
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by locating compile-frame and reviewing how its existing pre-encoder and post-decoder methods are implemented. Then inspect the codec-related tests and determine how a pre-decoder transform should receive the ByteBuffer before decoding. Done means compile-frame supports that transform and the behavior is covered by tests for the stated header-unfolding use case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- clojure
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100