mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Set cookie headers on the request, rather than the load data, to ensure they are used after redirects occur.
This commit is contained in:
parent
14df9f8a70
commit
504094aa84
1 changed files with 8 additions and 8 deletions
|
@ -108,14 +108,6 @@ reason: \"certificate verify failed\" }]";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let (tx, rx) = channel();
|
|
||||||
cookies_chan.send(ControlMsg::GetCookiesForUrl(url.clone(), tx, CookieSource::HTTP));
|
|
||||||
if let Some(cookies) = rx.recv().unwrap() {
|
|
||||||
let mut v = Vec::new();
|
|
||||||
v.push(cookies.into_bytes());
|
|
||||||
load_data.headers.set_raw("Cookie".to_owned(), v);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Avoid automatically preserving request headers when redirects occur.
|
// Avoid automatically preserving request headers when redirects occur.
|
||||||
// See https://bugzilla.mozilla.org/show_bug.cgi?id=401564 and
|
// See https://bugzilla.mozilla.org/show_bug.cgi?id=401564 and
|
||||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=216828
|
// https://bugzilla.mozilla.org/show_bug.cgi?id=216828
|
||||||
|
@ -126,6 +118,14 @@ reason: \"certificate verify failed\" }]";
|
||||||
req.headers_mut().set(host);
|
req.headers_mut().set(host);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let (tx, rx) = channel();
|
||||||
|
cookies_chan.send(ControlMsg::GetCookiesForUrl(url.clone(), tx, CookieSource::HTTP));
|
||||||
|
if let Some(cookies) = rx.recv().unwrap() {
|
||||||
|
let mut v = Vec::new();
|
||||||
|
v.push(cookies.into_bytes());
|
||||||
|
load_data.headers.set_raw("Cookie".to_owned(), v);
|
||||||
|
}
|
||||||
|
|
||||||
// FIXME(seanmonstar): use AcceptEncoding from Hyper once available
|
// FIXME(seanmonstar): use AcceptEncoding from Hyper once available
|
||||||
//if !req.headers.has::<AcceptEncoding>() {
|
//if !req.headers.has::<AcceptEncoding>() {
|
||||||
// We currently don't support HTTP Compression (FIXME #2587)
|
// We currently don't support HTTP Compression (FIXME #2587)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue