Age | Commit message (Collapse) | Author |
|
|
|
|
|
- Hat tip to Fabian Freyer of Radically Open Security.
|
|
- Consume the whole buffer, not just DEFAULT_BUF_SIZE.
|
|
|
|
- This cleanly avoids creating a linked list of references on the
stack that grows every time we call into_inner.
|
|
- Also, make PacketHeaderParser polymorphic over
BufferedReader<Cookie> at the same time.
|
|
|
|
This reverts commit 9619dffaa756d8cfd6ec691699bd6ae4d59ecfb5.
|
|
- This method returns the reader in a box. The nice thing is that
we can provide a specialized implementation for
Box<BufferedReader> that avoids boxing the reader twice. This
cleanly addresses the issue worked around in
9619dffaa756d8cfd6ec691699bd6ae4d59ecfb5.
|
|
|
|
|
|
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
|
|
|
|
|
|
- If the internal buffer has some data, process that before reading
more.
|
|
- On debug builds, Vec<u8>::truncate is very, very slow. For
instance, running the decrypt_test_stream test takes 51 seconds on
my (Neal's) computer using Vec<u8>::truncate and <0.1 seconds using
`unsafe { v.set_len(len); }`.
The issue is that the compiler calls drop on every element that is
dropped, even though a u8 doesn't have a drop implementation. The
compiler optimizes this away at high optimization levels, but
those levels make debugging harder.
|
|
- The `Generic::data_helper` was not sufficiently careful when
dealing with errors. In particular:
- If `Generic::data_hard(1)` was called, and an error occured, and
nothing was buffered or read, `Generic::data_helper` would
return the empty string instead of the error.
- If `Generic::data(n)` was called, and an error occured, but some
data (< n bytes) was buffered, `Generic::data_helper` would
return the error instead of the data that was read.
- Fix these bugs.
- Also, simplify the code and don't save whether we hit EOF or the
error (which we can only return once, anyway). Instead, rely on
the underlying reader to return EOF or the error again.
- Fixes #174.
|
|
- Change BufferedReader::drop_through to optionally match EOF.
|
|
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
|
|
|
|
Newer Rust compilers requre `dyn` marking trait objects.
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
|
|
|
|
|
|
- This is the result of running `cargo fix --edition`, with some
manual adjustments.
- The vast majority of changes merely qualify module paths with
'crate::'.
- Two instances of adding an anonymous pattern to a trait's
function.
- `async` is a keyword in Rust 2018, and hence it needs to be
escaped (e.g. in the case of the net::r#async module).
- The manual adjustments were needed due to various shortcomings of
the analysis employed by `cargo fix`, e.g. unexpanded macros,
procedural macros, lalrpop grammars.
|
|
|
|
|
|
- Fixes #237.
|
|
|
|
|
|
- Add convenience methods to the BufferReader trait to drop data
until some byte is encountered (BufferedReader::drop_until and
BufferedReader::drop_through).
|
|
- Also bump rfc2822 to 0.6.0. After all, we create tags for the
versions.
|
|
|
|
|
|
|
|
- Previously, if the underlying reader returned less data than
'amount', the limit would still be reduced by 'amount'.
|
|
|
|
|
|
|
|
- For example, `buffered_reader::BufferedReaderMemory` is now called
`buffered_reader::Memory`. This makes the type names less unwieldy.
- Fixes #206.
|
|
- According to the BufferedReader interface it is okay to return
short reads on `BufferedReader::data_consume()`.
- If `BufferedReader::data_consume_hard()` is called, return
UnexpectedEof instead of panicking.
- Fixes #207.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- Also, update BufferedReaders to implement it.
|
|
|