drogue-iot / reqwless

Rust async HTTP client for embedded/no_std
Apache License 2.0
129 stars 18 forks source link

ChunkedBodyReader: do not continue reading if remaining is zero #57

Closed vhdirk closed 1 year ago

vhdirk commented 1 year ago

read would hang if max_len is zero

rmja commented 1 year ago

@vhdirk @bugadani I added a test for this and a missing read of the final termination \r\n when an empty chunk is detected.

bugadani commented 1 year ago

Good find and I think the added check is fine, but I think the underlying bug is https://github.com/drogue-iot/embedded-tls/pull/130

rmja commented 1 year ago

@vhdirk Sorry for polluting the PR with my commits. I though I was adding tests showing your issue, but it was actually finding a different issue. A read with an empty buffer is well defined and should simply return Ok(0). The underlying issue to the problem that you see is, as @bugadani pointed out, in embedded-tls. The issue is fixed over there, and the fix in reqwless that I found in my commits to this PR are now over in #58 .