Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Add a Codec for the chunked transfer coding. #8

Merged
merged 1 commit into from
Dec 6, 2016
Merged

Add a Codec for the chunked transfer coding. #8

merged 1 commit into from
Dec 6, 2016

Conversation

nex3
Copy link
Member

@nex3 nex3 commented Nov 30, 2016

Related to dart-lang/shelf#64

Copy link

@efortuna efortuna left a 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);
Copy link

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

Copy link
Member Author

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);
Copy link

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.

Copy link
Member Author

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
Copy link

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above.

Copy link

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
Copy link

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?

chunked transfer coding

Copy link
Member Author

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
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doh. :-P

@nex3 nex3 merged commit 50e55f6 into master Dec 6, 2016
@nex3 nex3 deleted the chunked branch December 6, 2016 21:44
mosuem pushed a commit to dart-lang/http that referenced this pull request Oct 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants