mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Partial implementation of HTTP-network-or-cache fetch step.
This commit is contained in:
parent
c1cb9403a7
commit
d30998c4a6
4 changed files with 636 additions and 324 deletions
|
@ -72,6 +72,15 @@ pub enum ResponseBody {
|
|||
Done(Vec<u8>),
|
||||
}
|
||||
|
||||
// [Cache state](https://fetch.spec.whatwg.org/#concept-response-cache-state)
|
||||
#[derive(Clone)]
|
||||
pub enum CacheState {
|
||||
None,
|
||||
Local,
|
||||
Validated,
|
||||
Partial
|
||||
}
|
||||
|
||||
pub enum ResponseMsg {
|
||||
Chunk(Vec<u8>),
|
||||
Finished,
|
||||
|
@ -89,6 +98,7 @@ pub struct Response {
|
|||
pub status: Option<StatusCode>,
|
||||
pub headers: Headers,
|
||||
pub body: ResponseBody,
|
||||
pub cache_state: CacheState,
|
||||
/// [Internal response](https://fetch.spec.whatwg.org/#concept-internal-response), only used if the Response
|
||||
/// is a filtered response
|
||||
pub internal_response: Option<Rc<RefCell<Response>>>,
|
||||
|
@ -104,6 +114,7 @@ impl Response {
|
|||
status: None,
|
||||
headers: Headers::new(),
|
||||
body: ResponseBody::Empty,
|
||||
cache_state: CacheState::None,
|
||||
internal_response: None
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue