6 Commits

Author SHA1 Message Date
Benjamin M. Schwartz
c7cf12703d quicvarint: tolerate empty reads of the underlying io.Reader (#5275)
* Tolerate empty reads in `quicvarint.Read`

Currently, `quicvarint.Read` misinterprets an empty read (`n==0`)
as a single zero byte.  While empty reads are "discouraged" in
the `io.Reader` interface, they do sometimes happen, especially
when using `io.Pipe()`.

This change tolerates empty reads, adds a corresponding unit test,
and also includes some additional test coverage related to empty
capsules

* minor test refactor

---------

Co-authored-by: Marten Seemann <martenseemann@gmail.com>
2025-08-05 08:05:52 +02:00
Marten Seemann
4aee0c0acd quicvarint: migrate tests away from Ginkgo (#4662) 2024-09-11 22:22:17 -07:00
Marten Seemann
04c3fd0756 deprecate quicvarint.Write in favor of quicvarint.Append (#3690) 2023-02-13 02:52:25 -08:00
Marten Seemann
870fbe7ab0 migrate to Ginkgo v2 2022-10-11 16:38:44 +04:00
Marten Seemann
9d5de12933 make it possible to parse a varint at the end of a reader (#3428)
An io.Reader can read into the buffer and return the io.EOF in the same
call. In fact, that's how the quic.Stream is implemented.
In that case, we shouldn't return an error from quicvarint.Read,
otherwise the caller won't be able to parse a varint sent just before a
stream was closed.
2022-05-26 10:52:50 -07:00
Randy Reddig
346bd63a60 quicvarint: add Reader and Writer interfaces (#3233) 2021-08-05 10:49:17 -07:00