wtf is wrong with the space eating

serve
Avril 4 years ago
parent 93e1d335dc
commit d44fa5c40b
Signed by: flanchan
GPG Key ID: 284488987C31F630

2
Cargo.lock generated

@ -639,7 +639,7 @@ dependencies = [
[[package]] [[package]]
name = "markov" name = "markov"
version = "0.3.3" version = "0.3.4"
dependencies = [ dependencies = [
"async-compression", "async-compression",
"cfg-if 1.0.0", "cfg-if 1.0.0",

@ -15,10 +15,12 @@ pub async fn full(who: &IpAddr, state: State, mut body: impl Unpin + Stream<Item
while let Some(buf) = body.next().await { while let Some(buf) = body.next().await {
let mut body = buf.map_err(|_| FillBodyError)?; let mut body = buf.map_err(|_| FillBodyError)?;
while body.has_remaining() { while body.has_remaining() {
buffer.extend_from_slice(body.bytes()); if body.bytes().len() > 0 {
let cnt = body.bytes().len(); buffer.extend_from_slice(body.bytes()); // XXX: what the fuck is wrong with this??? why it eat spaces????
body.advance(cnt); let cnt = body.bytes().len();
written += cnt; body.advance(cnt);
written += cnt;
}
} }
} }
if !buffer.ends_with(&[b'\n']) { // probably useless eh? if !buffer.ends_with(&[b'\n']) { // probably useless eh?

Loading…
Cancel
Save