mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Store the referrer in the Response and return it in Response::metadata().
This commit is contained in:
parent
a66f186866
commit
28d06ab40a
2 changed files with 6 additions and 1 deletions
|
@ -1025,6 +1025,7 @@ fn http_network_fetch(request: Rc<Request>,
|
||||||
response.raw_status = Some((res.response.status_raw().0,
|
response.raw_status = Some((res.response.status_raw().0,
|
||||||
res.response.status_raw().1.as_bytes().to_vec()));
|
res.response.status_raw().1.as_bytes().to_vec()));
|
||||||
response.headers = res.response.headers.clone();
|
response.headers = res.response.headers.clone();
|
||||||
|
response.referrer = request.referrer.borrow().to_url().cloned();
|
||||||
|
|
||||||
let res_body = response.body.clone();
|
let res_body = response.body.clone();
|
||||||
|
|
||||||
|
|
|
@ -91,6 +91,7 @@ pub struct Response {
|
||||||
pub body: Arc<Mutex<ResponseBody>>,
|
pub body: Arc<Mutex<ResponseBody>>,
|
||||||
pub cache_state: CacheState,
|
pub cache_state: CacheState,
|
||||||
pub https_state: HttpsState,
|
pub https_state: HttpsState,
|
||||||
|
pub referrer: Option<Url>,
|
||||||
/// [Internal response](https://fetch.spec.whatwg.org/#concept-internal-response), only used if the Response
|
/// [Internal response](https://fetch.spec.whatwg.org/#concept-internal-response), only used if the Response
|
||||||
/// is a filtered response
|
/// is a filtered response
|
||||||
pub internal_response: Option<Box<Response>>,
|
pub internal_response: Option<Box<Response>>,
|
||||||
|
@ -111,6 +112,7 @@ impl Response {
|
||||||
body: Arc::new(Mutex::new(ResponseBody::Empty)),
|
body: Arc::new(Mutex::new(ResponseBody::Empty)),
|
||||||
cache_state: CacheState::None,
|
cache_state: CacheState::None,
|
||||||
https_state: HttpsState::None,
|
https_state: HttpsState::None,
|
||||||
|
referrer: None,
|
||||||
internal_response: None,
|
internal_response: None,
|
||||||
return_internal: Cell::new(true)
|
return_internal: Cell::new(true)
|
||||||
}
|
}
|
||||||
|
@ -128,6 +130,7 @@ impl Response {
|
||||||
body: Arc::new(Mutex::new(ResponseBody::Empty)),
|
body: Arc::new(Mutex::new(ResponseBody::Empty)),
|
||||||
cache_state: CacheState::None,
|
cache_state: CacheState::None,
|
||||||
https_state: HttpsState::None,
|
https_state: HttpsState::None,
|
||||||
|
referrer: None,
|
||||||
internal_response: None,
|
internal_response: None,
|
||||||
return_internal: Cell::new(true)
|
return_internal: Cell::new(true)
|
||||||
}
|
}
|
||||||
|
@ -244,6 +247,7 @@ impl Response {
|
||||||
metadata.headers = Some(Serde(response.headers.clone()));
|
metadata.headers = Some(Serde(response.headers.clone()));
|
||||||
metadata.status = response.raw_status.clone();
|
metadata.status = response.raw_status.clone();
|
||||||
metadata.https_state = response.https_state;
|
metadata.https_state = response.https_state;
|
||||||
|
metadata.referrer = response.referrer.clone();
|
||||||
metadata
|
metadata
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue