mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Avoid sending a new chunk when the body is already done
As discussed in https://github.com/servo/servo/issues/26807#issuecomment-640151804, we'd like to add a new flag, `in_memory_done`, to `TransmitBodyConnectHandler` so that we can correctly finish and drop the sender correctly. When we send the bytes, we will mark the body as done and we can recognize it's already done in next tick so that we can send a Done request to finish the sender. Also, when there comes a redirect request, it will go to `re-extract` route, we can set the `done` flag to `false` which means we won't stop the IPC routers yet. Then, if the re-extract sent its bytes, we will be marked as done again so that we can finish with stopping the IPC routes when Chunk request comes.
This commit is contained in:
parent
9798373d5e
commit
63aab1b355
2 changed files with 32 additions and 8 deletions
|
@ -117,7 +117,7 @@ pub enum ParserMetadata {
|
|||
}
|
||||
|
||||
/// <https://fetch.spec.whatwg.org/#concept-body-source>
|
||||
#[derive(Clone, Debug, Deserialize, MallocSizeOf, Serialize)]
|
||||
#[derive(Clone, Debug, Deserialize, MallocSizeOf, PartialEq, Serialize)]
|
||||
pub enum BodySource {
|
||||
Null,
|
||||
Object,
|
||||
|
@ -178,10 +178,7 @@ impl RequestBody {
|
|||
}
|
||||
|
||||
pub fn source_is_null(&self) -> bool {
|
||||
if let BodySource::Null = self.source {
|
||||
return true;
|
||||
}
|
||||
false
|
||||
self.source == BodySource::Null
|
||||
}
|
||||
|
||||
pub fn len(&self) -> Option<usize> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue