mirror of
https://github.com/servo/servo.git
synced 2025-08-02 04:00:32 +01:00
Add FetchMetadata and update corresponding methods
This commit is contained in:
parent
4dcf693a75
commit
07c9cfecec
5 changed files with 75 additions and 29 deletions
|
@ -170,7 +170,7 @@ pub enum FetchResponseMsg {
|
|||
ProcessRequestBody,
|
||||
ProcessRequestEOF,
|
||||
// todo: send more info about the response (or perhaps the entire Response)
|
||||
ProcessResponse(Result<Metadata, NetworkError>),
|
||||
ProcessResponse(Result<FetchMetadata, NetworkError>),
|
||||
ProcessResponseChunk(Vec<u8>),
|
||||
ProcessResponseEOF(Result<(), NetworkError>),
|
||||
}
|
||||
|
@ -200,10 +200,25 @@ pub trait FetchTaskTarget {
|
|||
fn process_response_eof(&mut self, response: &Response);
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub enum FilteredMetadata {
|
||||
Opaque,
|
||||
Transparent(Metadata)
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub enum FetchMetadata {
|
||||
Unfiltered(Metadata),
|
||||
Filtered {
|
||||
filtered: FilteredMetadata,
|
||||
unsafe_: Metadata
|
||||
}
|
||||
}
|
||||
|
||||
pub trait FetchResponseListener {
|
||||
fn process_request_body(&mut self);
|
||||
fn process_request_eof(&mut self);
|
||||
fn process_response(&mut self, metadata: Result<Metadata, NetworkError>);
|
||||
fn process_response(&mut self, metadata: Result<FetchMetadata, NetworkError>);
|
||||
fn process_response_chunk(&mut self, chunk: Vec<u8>);
|
||||
fn process_response_eof(&mut self, response: Result<(), NetworkError>);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue