Closed AnthonyGrondin closed 1 year ago
This is an issue similar as https://github.com/esp-rs/esp-wifi/pull/216 where Ok(0) is returned from read() if there's no data.
Ok(0)
read()
This causes issues when trying to use the read() impl from inside other crates, since it might interpret Ok(0) as an EOF. This is what happens initially during a request handshake.
This forces the use of something like:
loop { match tls.read(&mut temp_buffer).await { Ok(0) => continue, Ok(_) => break, Err(TlsError::Eof) => { log::error!("EOF"); break; } Err(e) => { log::error!("Read Error {:?}", e); break; } }; }
and then use this temporary buffer for the other crates.
For example, trying to use the current read() impl inside https://github.com/drogue-iot/reqwless/blob/f23567d8d178dd837332b503fe983ba4931d8b40/src/response.rs#L47-L58 will result in no data being read.
True, both the blocking and the async embedded-io read should only return Ok(0) on EOF. We need to change that
read
This is an issue similar as https://github.com/esp-rs/esp-wifi/pull/216 where
Ok(0)
is returned fromread()
if there's no data.This causes issues when trying to use the
read()
impl from inside other crates, since it might interpretOk(0)
as an EOF. This is what happens initially during a request handshake.This forces the use of something like:
and then use this temporary buffer for the other crates.
For example, trying to use the current
read()
impl inside https://github.com/drogue-iot/reqwless/blob/f23567d8d178dd837332b503fe983ba4931d8b40/src/response.rs#L47-L58 will result in no data being read.