fix(http): fix encoding when buffer is full
This commit is contained in:
@@ -54,9 +54,12 @@ impl Encoder {
|
||||
chunked.encode(w, msg)
|
||||
},
|
||||
Kind::Length(ref mut remaining) => {
|
||||
if msg.is_empty() {
|
||||
return Ok(0);
|
||||
}
|
||||
let n = {
|
||||
let max = cmp::min(*remaining as usize, msg.len());
|
||||
trace!("sized write, len = {}", max);
|
||||
trace!("sized write, len = {}, remaining = {}", max, remaining);
|
||||
let slice = &msg[..max];
|
||||
|
||||
try!(w.write_atomic(&[slice]))
|
||||
|
||||
Reference in New Issue
Block a user