rust upgrade
This commit is contained in:
		| @@ -16,6 +16,10 @@ use cookie::CookieJar; | |||||||
| #[deriving(Clone, PartialEq, Show)] | #[deriving(Clone, PartialEq, Show)] | ||||||
| pub struct Cookies(pub Vec<Cookie>); | pub struct Cookies(pub Vec<Cookie>); | ||||||
|  |  | ||||||
|  | //TODO: remove when fixed in libstd | ||||||
|  | unsafe impl Send for Cookies {} | ||||||
|  | unsafe impl Sync for Cookies {} | ||||||
|  |  | ||||||
| deref!(Cookies -> Vec<Cookie>); | deref!(Cookies -> Vec<Cookie>); | ||||||
|  |  | ||||||
| impl Header for Cookies { | impl Header for Cookies { | ||||||
|   | |||||||
| @@ -13,6 +13,10 @@ use cookie::CookieJar; | |||||||
| #[deriving(Clone, PartialEq, Show)] | #[deriving(Clone, PartialEq, Show)] | ||||||
| pub struct SetCookie(pub Vec<Cookie>); | pub struct SetCookie(pub Vec<Cookie>); | ||||||
|  |  | ||||||
|  | //TODO: remove when fixed in libstd | ||||||
|  | unsafe impl Send for SetCookie {} | ||||||
|  | unsafe impl Sync for SetCookie {} | ||||||
|  |  | ||||||
| deref!(SetCookie -> Vec<Cookie>); | deref!(SetCookie -> Vec<Cookie>); | ||||||
|  |  | ||||||
| impl Header for SetCookie { | impl Header for SetCookie { | ||||||
|   | |||||||
| @@ -5,7 +5,7 @@ | |||||||
| //! must implement the `Header` trait from this module. Several common headers | //! must implement the `Header` trait from this module. Several common headers | ||||||
| //! are already provided, such as `Host`, `ContentType`, `UserAgent`, and others. | //! are already provided, such as `Host`, `ContentType`, `UserAgent`, and others. | ||||||
| use std::any::Any; | use std::any::Any; | ||||||
| use std::ascii::{AsciiExt, AsciiCast}; | use std::ascii::AsciiExt; | ||||||
| use std::borrow::Cow::{Borrowed, Owned}; | use std::borrow::Cow::{Borrowed, Owned}; | ||||||
| use std::fmt::{mod, Show}; | use std::fmt::{mod, Show}; | ||||||
| use std::intrinsics::TypeId; | use std::intrinsics::TypeId; | ||||||
| @@ -127,7 +127,7 @@ impl Headers { | |||||||
|         loop { |         loop { | ||||||
|             match try!(http::read_header(rdr)) { |             match try!(http::read_header(rdr)) { | ||||||
|                 Some((name, value)) => { |                 Some((name, value)) => { | ||||||
|                     debug!("raw header: {}={}", name, value[].to_ascii()); |                     debug!("raw header: {}={}", name, value[]); | ||||||
|                     let name = CaseInsensitive(Owned(name)); |                     let name = CaseInsensitive(Owned(name)); | ||||||
|                     let mut item = match headers.data.entry(name) { |                     let mut item = match headers.data.entry(name) { | ||||||
|                         Entry::Vacant(entry) => entry.set(MuCell::new(Item::raw(vec![]))), |                         Entry::Vacant(entry) => entry.set(MuCell::new(Item::raw(vec![]))), | ||||||
| @@ -488,7 +488,7 @@ impl<H: hash::Writer> hash::Hash<H> for CaseInsensitive { | |||||||
|     #[inline] |     #[inline] | ||||||
|     fn hash(&self, hasher: &mut H) { |     fn hash(&self, hasher: &mut H) { | ||||||
|         for b in self.as_slice().bytes() { |         for b in self.as_slice().bytes() { | ||||||
|             hasher.write(&[b.to_ascii().to_lowercase().as_byte()]) |             hasher.write(&[b.to_ascii_lowercase()]) | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -376,8 +376,6 @@ pub fn read_method<R: Reader>(stream: &mut R) -> HttpResult<method::Method> { | |||||||
|         return Err(HttpMethodError); |         return Err(HttpMethodError); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     debug!("method buf = {}", buf[].to_ascii()); |  | ||||||
|  |  | ||||||
|     let maybe_method = match buf[0..7] { |     let maybe_method = match buf[0..7] { | ||||||
|         b"GET    " => Some(method::Method::Get), |         b"GET    " => Some(method::Method::Get), | ||||||
|         b"PUT    " => Some(method::Method::Put), |         b"PUT    " => Some(method::Method::Put), | ||||||
| @@ -548,8 +546,6 @@ pub fn read_header<R: Reader>(stream: &mut R) -> HttpResult<Option<RawHeaderLine | |||||||
|     let real_len = value.len() - value.iter().rev().take_while(|&&x| b' ' == x).count(); |     let real_len = value.len() - value.iter().rev().take_while(|&&x| b' ' == x).count(); | ||||||
|     value.truncate(real_len); |     value.truncate(real_len); | ||||||
|  |  | ||||||
|     debug!("header value = {}", value[].to_ascii()); |  | ||||||
|  |  | ||||||
|     match try!(stream.read_byte()) { |     match try!(stream.read_byte()) { | ||||||
|         LF => Ok(Some((name, value))), |         LF => Ok(Some((name, value))), | ||||||
|         _ => Err(HttpHeaderError) |         _ => Err(HttpHeaderError) | ||||||
|   | |||||||
| @@ -154,7 +154,7 @@ use self::HttpError::{HttpMethodError, HttpUriError, HttpVersionError, | |||||||
|  |  | ||||||
| macro_rules! todo( | macro_rules! todo( | ||||||
|     ($($arg:tt)*) => (if cfg!(not(ndebug)) { |     ($($arg:tt)*) => (if cfg!(not(ndebug)) { | ||||||
|         format_args!(|args| log!(5, "TODO: {}", args), $($arg)*) |         log!(5, "TODO: {}", format_args!($($arg)*)) | ||||||
|     }) |     }) | ||||||
| ); | ); | ||||||
|  |  | ||||||
| @@ -170,7 +170,7 @@ impl fmt::Show for Trace { | |||||||
|  |  | ||||||
| macro_rules! trace( | macro_rules! trace( | ||||||
|     ($($arg:tt)*) => (if cfg!(not(ndebug)) { |     ($($arg:tt)*) => (if cfg!(not(ndebug)) { | ||||||
|         format_args!(|args| log!(5, "{}\n{}", args, ::Trace), $($arg)*) |         log!(5, "{}\n{}", format_args!($($arg)*), ::Trace) | ||||||
|     }) |     }) | ||||||
| ); | ); | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user