Make CompoundBody consumption past end idempotent
This commit is contained in:
parent
d1a5389060
commit
65b5399dbe
|
@ -22,6 +22,7 @@ pub struct CompoundBody {
|
||||||
pub enum CompoundLimit {
|
pub enum CompoundLimit {
|
||||||
Counted(usize),
|
Counted(usize),
|
||||||
Streaming,
|
Streaming,
|
||||||
|
Finished,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CompoundBody {
|
impl CompoundBody {
|
||||||
|
@ -38,6 +39,7 @@ impl CompoundBody {
|
||||||
CompoundLimit::Counted(ref mut n) =>
|
CompoundLimit::Counted(ref mut n) =>
|
||||||
if *n == 0 {
|
if *n == 0 {
|
||||||
read.close_compound_counted(self.minor)?;
|
read.close_compound_counted(self.minor)?;
|
||||||
|
self.limit = CompoundLimit::Finished;
|
||||||
Ok(false)
|
Ok(false)
|
||||||
} else {
|
} else {
|
||||||
*n = *n - 1;
|
*n = *n - 1;
|
||||||
|
@ -45,6 +47,8 @@ impl CompoundBody {
|
||||||
},
|
},
|
||||||
CompoundLimit::Streaming =>
|
CompoundLimit::Streaming =>
|
||||||
Ok(!read.close_compound_stream(self.minor)?),
|
Ok(!read.close_compound_stream(self.minor)?),
|
||||||
|
CompoundLimit::Finished =>
|
||||||
|
Ok(false),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue