diff --git a/components/net/http_loader.rs b/components/net/http_loader.rs index 69349234691..de1be171e8f 100644 --- a/components/net/http_loader.rs +++ b/components/net/http_loader.rs @@ -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. // See https://bugzilla.mozilla.org/show_bug.cgi?id=401564 and // https://bugzilla.mozilla.org/show_bug.cgi?id=216828 @@ -126,6 +118,14 @@ reason: \"certificate verify failed\" }]"; 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 //if !req.headers.has::() { // We currently don't support HTTP Compression (FIXME #2587)