diff --git a/src/header/common/authorization.rs b/src/header/common/authorization.rs index 27f97ec4..fe370c5d 100644 --- a/src/header/common/authorization.rs +++ b/src/header/common/authorization.rs @@ -1,6 +1,6 @@ use std::fmt::{mod, Show}; use std::str::{FromStr, from_utf8}; -use serialize::base64::{ToBase64, FromBase64, Standard, Config}; +use serialize::base64::{ToBase64, FromBase64, Standard, Config, Newline}; use header::{Header, HeaderFormat}; /// The `Authorization` header field. @@ -97,6 +97,7 @@ impl Scheme for Basic { } text.as_bytes().to_base64(Config { char_set: Standard, + newline: Newline::CRLF, pad: true, line_length: None }).fmt(f) diff --git a/src/header/common/content_length.rs b/src/header/common/content_length.rs index 044b7b71..677c8d3c 100644 --- a/src/header/common/content_length.rs +++ b/src/header/common/content_length.rs @@ -6,7 +6,7 @@ use super::util::from_one_raw_str; /// The `Content-Length` header. /// /// Simply a wrapper around a `uint`. -#[deriving(Clone, PartialEq, Show)] +#[deriving(Copy, Clone, PartialEq, Show)] pub struct ContentLength(pub uint); deref!(ContentLength -> uint) diff --git a/src/header/common/date.rs b/src/header/common/date.rs index 7a283c0e..928a55c1 100644 --- a/src/header/common/date.rs +++ b/src/header/common/date.rs @@ -6,7 +6,7 @@ use super::util::{from_one_raw_str, tm_from_str}; // Egh, replace as soon as something better than time::Tm exists. /// The `Date` header field. -#[deriving(PartialEq, Clone)] +#[deriving(Copy, PartialEq, Clone)] pub struct Date(pub Tm); deref!(Date -> Tm) diff --git a/src/header/common/etag.rs b/src/header/common/etag.rs index 83801a8b..f98a65af 100644 --- a/src/header/common/etag.rs +++ b/src/header/common/etag.rs @@ -118,7 +118,7 @@ mod tests { etag = Header::parse_header([b"W/\"\x65\x62\"".to_vec()].as_slice()); assert_eq!(etag, Some(Etag { weak: true, - tag: "\u0065\u0062".into_string() + tag: "\u{0065}\u{0062}".into_string() })); etag = Header::parse_header([b"W/\"\"".to_vec()].as_slice()); @@ -153,4 +153,4 @@ mod tests { } } -bench_header!(bench, Etag, { vec![b"W/\"nonemptytag\"".to_vec()] }) \ No newline at end of file +bench_header!(bench, Etag, { vec![b"W/\"nonemptytag\"".to_vec()] }) diff --git a/src/header/common/expires.rs b/src/header/common/expires.rs index b11e08fe..968ec023 100644 --- a/src/header/common/expires.rs +++ b/src/header/common/expires.rs @@ -5,7 +5,7 @@ use header::{Header, HeaderFormat}; use super::util::{from_one_raw_str, tm_from_str}; /// The `Expires` header field. -#[deriving(PartialEq, Clone)] +#[deriving(Copy, PartialEq, Clone)] pub struct Expires(pub Tm); deref!(Expires -> Tm) diff --git a/src/header/common/if_modified_since.rs b/src/header/common/if_modified_since.rs index 8b2d60c4..7524cd52 100644 --- a/src/header/common/if_modified_since.rs +++ b/src/header/common/if_modified_since.rs @@ -5,7 +5,7 @@ use header::{Header, HeaderFormat}; use super::util::{from_one_raw_str, tm_from_str}; /// The `If-Modified-Since` header field. -#[deriving(PartialEq, Clone)] +#[deriving(Copy, PartialEq, Clone)] pub struct IfModifiedSince(pub Tm); deref!(IfModifiedSince -> Tm) diff --git a/src/header/common/last_modified.rs b/src/header/common/last_modified.rs index 83e19ad1..0b43fe1f 100644 --- a/src/header/common/last_modified.rs +++ b/src/header/common/last_modified.rs @@ -5,7 +5,7 @@ use header::{Header, HeaderFormat}; use super::util::{from_one_raw_str, tm_from_str}; /// The `LastModified` header field. -#[deriving(PartialEq, Clone)] +#[deriving(Copy, PartialEq, Clone)] pub struct LastModified(pub Tm); deref!(LastModified -> Tm) diff --git a/src/http.rs b/src/http.rs index d3a61a1b..90fbc40b 100644 --- a/src/http.rs +++ b/src/http.rs @@ -285,6 +285,8 @@ pub const LINE_ENDING: &'static [u8] = &[CR, LF]; /// A `Show`able struct to easily write line endings to a formatter. pub struct LineEnding; +impl Copy for LineEnding {} + impl fmt::Show for LineEnding { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fmt.write(LINE_ENDING) diff --git a/src/lib.rs b/src/lib.rs index 33e5a28e..2c80be30 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -163,7 +163,7 @@ struct Trace; impl fmt::Show for Trace { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { let _ = backtrace::write(fmt); - ::std::result::Ok(()) + Result::Ok(()) } } diff --git a/src/net.rs b/src/net.rs index 4f9f1aec..5a9f3f1a 100644 --- a/src/net.rs +++ b/src/net.rs @@ -18,9 +18,11 @@ use openssl::ssl::error::{SslError, StreamError, OpenSslErrors, SslSessionClosed use self::HttpStream::{Http, Https}; /// The write-status indicating headers have not been written. +#[allow(missing_copy_implementations)] pub struct Fresh; /// The write-status indicating headers have been written. +#[allow(missing_copy_implementations)] pub struct Streaming; /// An abstraction to listen for connections on a certain port. @@ -236,6 +238,7 @@ impl NetworkStream for HttpStream { } /// A connector that will produce HttpStreams. +#[allow(missing_copy_implementations)] pub struct HttpConnector; impl NetworkConnector for HttpConnector { diff --git a/src/status.rs b/src/status.rs index d856be37..189d29b7 100644 --- a/src/status.rs +++ b/src/status.rs @@ -1569,6 +1569,8 @@ impl StatusCode { } } +impl Copy for StatusCode {} + /// Formats the status code, *including* the canonical reason. /// /// ```rust @@ -1684,7 +1686,7 @@ impl ToPrimitive for StatusCode { /// to get the appropriate *category* of status. /// /// For HTTP/2.0, the 1xx Informational class is invalid. -#[deriving(Clone, PartialEq, Eq, PartialOrd, Ord)] +#[deriving(Clone, PartialEq, Eq, PartialOrd, Ord, Copy)] pub enum StatusClass { /// 1xx: Informational - Request received, continuing process Informational = 100, diff --git a/src/version.rs b/src/version.rs index 1a978f0e..d0ec828f 100644 --- a/src/version.rs +++ b/src/version.rs @@ -7,7 +7,7 @@ use std::fmt; use self::HttpVersion::{Http09, Http10, Http11, Http20}; /// Represents a version of the HTTP spec. -#[deriving(PartialEq, PartialOrd)] +#[deriving(PartialEq, PartialOrd, Copy)] pub enum HttpVersion { /// `HTTP/0.9` Http09,