-
Notifications
You must be signed in to change notification settings - Fork 28
Add a Codec for the chunked transfer coding. #8
Conversation
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.
looks good. minor adjustments suggested.
var size = end - start; | ||
var sizeInHex = size.toRadixString(16); | ||
var footerSize = isLast ? _doneChunk.length : 0; | ||
var list = new Uint8List(sizeInHex.length + 2 + size + footerSize); |
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.
Why +2 here and line 65?
Consider making a descriptive variable name to clarify
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.
Added a comment.
if (bytes[start] == $cr) { | ||
_state = _State.beforeLF; | ||
} else { | ||
_size = (_size << 4) + _digitForByte(bytes, start); |
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.
consider making 4 a named constant so we don't just have a magic number here.
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.
Added a comment.
|
||
/// A codec that encodes and decodes the [chunked transfer coding][]. | ||
/// | ||
/// [chunked transfer coding]: https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.6.1 |
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.
Why not make this a regular markdown link?
chunked transfer coding
or is this some syntax I'm just behind the times on?
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.
See above.
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.
doh. :-P
* Add `chunkedCoding`, a `Codec` that supports encoding and decoding the | ||
[chunked transfer coding][]. | ||
|
||
[chunked transfer coding]: https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.6.1 |
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.
Make it a Markdown link?
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.
This is a Markdown link 😊. Search for "implicit link name" in the syntax documentation.
|
||
/// A codec that encodes and decodes the [chunked transfer coding][]. | ||
/// | ||
/// [chunked transfer coding]: https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.6.1 |
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.
doh. :-P
Related to dart-lang/shelf#64