diff --git a/components/net/cookie.rs b/components/net/cookie.rs index 35c5d4dbe73..dfca6912c94 100644 --- a/components/net/cookie.rs +++ b/components/net/cookie.rs @@ -100,7 +100,7 @@ impl Cookie { request_path.chars().filter(|&c| c == '/').count() == 1 { "/".to_owned() } else if request_path.ends_with("/") { - request_path.slice_to(request_path.len()-1).to_owned() + request_path[..request_path.len() - 1].to_owned() } else { request_path.to_owned() } diff --git a/components/net/data_loader.rs b/components/net/data_loader.rs index 987b39568f3..bdaca050477 100644 --- a/components/net/data_loader.rs +++ b/components/net/data_loader.rs @@ -55,7 +55,7 @@ fn load(load_data: LoadData, start_chan: Sender) { let mut ct_str = parts[0]; if ct_str.ends_with(";base64") { is_base64 = true; - ct_str = ct_str.slice_to(ct_str.as_bytes().len() - 7); + ct_str = &ct_str[..ct_str.as_bytes().len() - 7]; } // Parse the content type using rust-http. diff --git a/components/net/http_loader.rs b/components/net/http_loader.rs index b23450c38df..9cb33763866 100644 --- a/components/net/http_loader.rs +++ b/components/net/http_loader.rs @@ -126,7 +126,7 @@ reason: \"certificate verify failed\" }]"; req.headers_mut().set(host); let (tx, rx) = channel(); - cookies_chan.send(ControlMsg::GetCookiesForUrl(url.clone(), tx, CookieSource::HTTP)); + cookies_chan.send(ControlMsg::GetCookiesForUrl(url.clone(), tx, CookieSource::HTTP)).unwrap(); if let Some(cookie_list) = rx.recv().unwrap() { let mut v = Vec::new(); v.push(cookie_list.into_bytes()); @@ -157,7 +157,7 @@ reason: \"certificate verify failed\" }]"; return; } }; - match writer.write(data.as_slice()) { + match writer.write_all(&*data) { Err(e) => { send_error(url, e.desc.to_string(), senders); return; @@ -201,7 +201,7 @@ reason: \"certificate verify failed\" }]"; if let Ok(cookies) = String::from_utf8(cookie.clone()) { cookies_chan.send(ControlMsg::SetCookiesForUrl(url.clone(), cookies, - CookieSource::HTTP)); + CookieSource::HTTP)).unwrap(); } } } diff --git a/components/net/lib.rs b/components/net/lib.rs index 4beb588047c..45a6c4c114e 100644 --- a/components/net/lib.rs +++ b/components/net/lib.rs @@ -2,12 +2,18 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#![feature(int_uint)] -#![feature(unboxed_closures)] #![feature(box_syntax)] +#![feature(collections)] +#![feature(core)] +#![feature(env)] +#![feature(int_uint)] +#![feature(io)] +#![feature(path)] +#![feature(rustc_private)] +#![feature(std_misc)] +#![feature(unboxed_closures)] #![allow(missing_copy_implementations)] -#![allow(unstable)] extern crate "cookie" as cookie_rs; extern crate collections; diff --git a/components/net/resource_task.rs b/components/net/resource_task.rs index b8c7190ebd9..c6f6414f125 100644 --- a/components/net/resource_task.rs +++ b/components/net/resource_task.rs @@ -23,12 +23,12 @@ use hyper::mime::{Mime, Attr}; use url::Url; use std::borrow::{ToOwned, IntoCow}; +use std::collections::HashMap; +use std::env; +use std::mem; +use std::old_io::{BufferedReader, File}; use std::sync::mpsc::{channel, Receiver, Sender}; use std::thunk::Invoke; -use std::collections::HashMap; -use std::old_io::{BufferedReader, File}; -use std::mem; -use std::os; #[cfg(test)] use std::old_io::{Listener, Acceptor, TimedOut}; @@ -38,7 +38,7 @@ use std::old_io::net::tcp::TcpListener; static mut HOST_TABLE: Option<*mut HashMap> = None; pub fn global_init() { - if let Some(host_file_path) = os::getenv("HOST_FILE") { + if let Ok(host_file_path) = env::var_string("HOST_FILE") { //TODO: handle bad file path and corrupted file let path = Path::new(host_file_path); let mut file = BufferedReader::new(File::open(&path)); @@ -291,7 +291,7 @@ impl ResourceManager { } } ControlMsg::GetCookiesForUrl(url, consumer, source) => { - consumer.send(self.cookie_storage.cookies_for_url(&url, source)); + consumer.send(self.cookie_storage.cookies_for_url(&url, source)).unwrap(); } ControlMsg::Exit => { break