14 Commits

Author SHA1 Message Date
Carl Lerche
cb4aea394e
Update Tokio to Rust 2018 (#1082) 2019-05-14 10:27:36 -07:00
Carl Lerche
949adbb887
chore: remember to remove path deps on release (#1057) 2019-04-24 10:42:39 -07:00
Carl Lerche
cdde2e7a27
chore: repo maintenance + no path dependencies (#991)
- Move `tokio` into its own directory.
- Remove `path` dependencies.
- Run tests with once with crates.io dep and once with patched dep.
2019-03-19 14:58:59 -07:00
Carl Lerche
80162306e7
chore: apply rustfmt to all crates (#917) 2019-02-21 11:56:15 -08:00
Carl Lerche
961aae41c4
Bump version to 0.1.14. (#836)
Also bumps:

* tokio-async-await (0.1.5)
* tokio-executor (0.1.6)
* tokio-fs (0.1.5)
* tokio-io (0.1.11)
* tokio-reactor (0.1.8)
* tokio-tcp (0.1.3)
* tokio-threadpool (0.1.10)
* tokio-tls (0.2.1)
* tokio-uds (0.2.5)

...and updates LICENSE files to 2019.
2019-01-06 23:25:55 -08:00
Carl Lerche
cab9a44e01
Bump version to v0.1.9 (#666)
This also includes bumps to subcrates.

* tokio-async-await (0.1.4)
* tokio-codec (0.1.1)
* tokio-current-thread (0.1.2)
* tokio-executor (0.1.5)
* tokio-io (0.1.9)
* tokio-reactor (0.1.6)
* tokio-tcp (0.1.2)
* tokio-threadpool (0.1.7)
* tokio-timer (0.2.7)
2018-09-26 22:32:51 -07:00
Eliza Weisman
3dd95a9ff1
Add max line length to LinesCodec (#632)
## Motivation

Currently, there is a potential denial of service vulnerability in the
`lines` codec. Since there is no bound on the buffer that holds data
before it is split into a new line, an attacker could send an unbounded
amount of data without sending a `\n` character. 

## Solution

This branch adds a `new_with_max_length` constructor for `LinesCodec`
that configures a limit on the maximum number of bytes per line. When
the limit is reached, the the overly long line will be discarded (in 
`max_length`-sized increments until a newline character or the end of the
buffer is reached. It was also necessary to add some special-case logic
to avoid creating an empty line when the length limit is reached at the 
character immediately _before_ a `\n` character.

Additionally, this branch adds new tests for this function, including a
test for changing the line limit in-flight.

## Notes

This branch makes the following changes from my original PR with
this change (#590):

- The whole too-long line is discarded at once in the first call to `decode`
  that encounters it.
- Only one error is emitted per too-long line.
- Made all the changes requested by @carllerche in
  https://github.com/tokio-rs/tokio/pull/590#issuecomment-420735023

Fixes: #186 

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
2018-09-20 17:08:00 -07:00
Carl Lerche
cc40a4e7f0
Revert "Add max line length to LinesCodec (#590)"
This reverts commit 4ae6c997ee2706bf5d10164926e9a29941aab58f.
2018-09-12 10:34:37 -07:00
Eliza Weisman
4ae6c997ee Add max line length to LinesCodec (#590)
* codec: add new constructor `with_max_length ` to `LinesCodec`
* codec: add security note to docs

Signed-off-by: Eliza Weisman <eliza@buoyant.io>

* Fix Rust 1.25 compatibility

* codec: Fix incorrect line lengths in tests (and add assertions)

Signed-off-by: Eliza Weisman <eliza@buoyant.io>

* codec: Fix off-by-one error in lines codec

Signed-off-by: Eliza Weisman <eliza@buoyant.io>

* codec: Fix call to decode rather than decode_eof in test

Signed-off-by: Eliza Weisman <eliza@buoyant.io>

* codec: Fix incorrect LinesCodec::decode_max_line_length

This bug was introduced after the fix for the off-by-one error.
Fortunately, the doctests caught it.

Signed-off-by: Eliza Weisman <eliza@buoyant.io>

* codec: Minor style improvements

Signed-off-by: Eliza Weisman <eliza@buoyant.io>

* codec: Don't allow LinesCodec length limit to be set after construction

Signed-off-by: Eliza Weisman <eliza@buoyant.io>

* codec: change LinesCodec to error and discard line when at max length

* codec: Fix build on Rust 1.25

The slice patterns syntax wasn't supported yet in that release.

Signed-off-by: Eliza Weisman <eliza@buoyant.io>

* codec: Add test for out-of-bounds index when peeking

Signed-off-by: Eliza Weisman <eliza@buoyant.io>

* codec: Fix out of bounds index

* codec: Fix incomplete comment

Signed-off-by: Eliza Weisman <eliza@buoyant.io>

* codec: Add test for line decoder buffer underrun
2018-09-12 13:02:57 -04:00
Gary M. Josack
28010b5962 Update lines_encoder test to use LinesCodec (#544)
The `lines_encoder` test is a copy/paste of `bytes_encoder` and not
testing the LinesCodec encoding at all. This updates the test to do
simple validations of the LinesCodec encoding.
2018-08-15 07:51:42 -04:00
Roman
3cf56b7bfa Fix unneeded mut and some deprecated api (#442) 2018-06-21 09:47:21 -07:00
Carl Lerche
c25ea78ec9
Bump version of a number of sub crates (#414)
This includes:

* tokio-codec (0.1.0)
* tokio-current-thread (0.1.0)
* tokio-fs (0.1.1)
* tokio-io (0.1.7)
* tokio-reactor (0.1.2)
* tokio-udp (0.1.1)
2018-06-13 10:24:56 -07:00
Carl Lerche
c07a7b26d3
Cleanup FramedParts in new tokio-codec (#394) 2018-06-05 15:31:01 -07:00
Bryan Burgers
f723d10087 Create tokio-codec (#360)
Create a new tokio-codec crate with many of the contents of
`tokio_io::codec`.
2018-06-04 20:36:06 -07:00