@@ -1,6 +1,6 @@
|
|||||||
use std::fmt::{mod, Show};
|
use std::fmt::{mod, Show};
|
||||||
use std::str::{FromStr, from_utf8};
|
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};
|
use header::{Header, HeaderFormat};
|
||||||
|
|
||||||
/// The `Authorization` header field.
|
/// The `Authorization` header field.
|
||||||
@@ -97,6 +97,7 @@ impl Scheme for Basic {
|
|||||||
}
|
}
|
||||||
text.as_bytes().to_base64(Config {
|
text.as_bytes().to_base64(Config {
|
||||||
char_set: Standard,
|
char_set: Standard,
|
||||||
|
newline: Newline::CRLF,
|
||||||
pad: true,
|
pad: true,
|
||||||
line_length: None
|
line_length: None
|
||||||
}).fmt(f)
|
}).fmt(f)
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ use super::util::from_one_raw_str;
|
|||||||
/// The `Content-Length` header.
|
/// The `Content-Length` header.
|
||||||
///
|
///
|
||||||
/// Simply a wrapper around a `uint`.
|
/// Simply a wrapper around a `uint`.
|
||||||
#[deriving(Clone, PartialEq, Show)]
|
#[deriving(Copy, Clone, PartialEq, Show)]
|
||||||
pub struct ContentLength(pub uint);
|
pub struct ContentLength(pub uint);
|
||||||
|
|
||||||
deref!(ContentLength -> uint)
|
deref!(ContentLength -> uint)
|
||||||
|
|||||||
@@ -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.
|
// Egh, replace as soon as something better than time::Tm exists.
|
||||||
/// The `Date` header field.
|
/// The `Date` header field.
|
||||||
#[deriving(PartialEq, Clone)]
|
#[deriving(Copy, PartialEq, Clone)]
|
||||||
pub struct Date(pub Tm);
|
pub struct Date(pub Tm);
|
||||||
|
|
||||||
deref!(Date -> Tm)
|
deref!(Date -> Tm)
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ mod tests {
|
|||||||
etag = Header::parse_header([b"W/\"\x65\x62\"".to_vec()].as_slice());
|
etag = Header::parse_header([b"W/\"\x65\x62\"".to_vec()].as_slice());
|
||||||
assert_eq!(etag, Some(Etag {
|
assert_eq!(etag, Some(Etag {
|
||||||
weak: true,
|
weak: true,
|
||||||
tag: "\u0065\u0062".into_string()
|
tag: "\u{0065}\u{0062}".into_string()
|
||||||
}));
|
}));
|
||||||
|
|
||||||
etag = Header::parse_header([b"W/\"\"".to_vec()].as_slice());
|
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()] })
|
bench_header!(bench, Etag, { vec![b"W/\"nonemptytag\"".to_vec()] })
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ use header::{Header, HeaderFormat};
|
|||||||
use super::util::{from_one_raw_str, tm_from_str};
|
use super::util::{from_one_raw_str, tm_from_str};
|
||||||
|
|
||||||
/// The `Expires` header field.
|
/// The `Expires` header field.
|
||||||
#[deriving(PartialEq, Clone)]
|
#[deriving(Copy, PartialEq, Clone)]
|
||||||
pub struct Expires(pub Tm);
|
pub struct Expires(pub Tm);
|
||||||
|
|
||||||
deref!(Expires -> Tm)
|
deref!(Expires -> Tm)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ use header::{Header, HeaderFormat};
|
|||||||
use super::util::{from_one_raw_str, tm_from_str};
|
use super::util::{from_one_raw_str, tm_from_str};
|
||||||
|
|
||||||
/// The `If-Modified-Since` header field.
|
/// The `If-Modified-Since` header field.
|
||||||
#[deriving(PartialEq, Clone)]
|
#[deriving(Copy, PartialEq, Clone)]
|
||||||
pub struct IfModifiedSince(pub Tm);
|
pub struct IfModifiedSince(pub Tm);
|
||||||
|
|
||||||
deref!(IfModifiedSince -> Tm)
|
deref!(IfModifiedSince -> Tm)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ use header::{Header, HeaderFormat};
|
|||||||
use super::util::{from_one_raw_str, tm_from_str};
|
use super::util::{from_one_raw_str, tm_from_str};
|
||||||
|
|
||||||
/// The `LastModified` header field.
|
/// The `LastModified` header field.
|
||||||
#[deriving(PartialEq, Clone)]
|
#[deriving(Copy, PartialEq, Clone)]
|
||||||
pub struct LastModified(pub Tm);
|
pub struct LastModified(pub Tm);
|
||||||
|
|
||||||
deref!(LastModified -> Tm)
|
deref!(LastModified -> Tm)
|
||||||
|
|||||||
@@ -285,6 +285,8 @@ pub const LINE_ENDING: &'static [u8] = &[CR, LF];
|
|||||||
/// A `Show`able struct to easily write line endings to a formatter.
|
/// A `Show`able struct to easily write line endings to a formatter.
|
||||||
pub struct LineEnding;
|
pub struct LineEnding;
|
||||||
|
|
||||||
|
impl Copy for LineEnding {}
|
||||||
|
|
||||||
impl fmt::Show for LineEnding {
|
impl fmt::Show for LineEnding {
|
||||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||||
fmt.write(LINE_ENDING)
|
fmt.write(LINE_ENDING)
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ struct Trace;
|
|||||||
impl fmt::Show for Trace {
|
impl fmt::Show for Trace {
|
||||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||||
let _ = backtrace::write(fmt);
|
let _ = backtrace::write(fmt);
|
||||||
::std::result::Ok(())
|
Result::Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,9 +18,11 @@ use openssl::ssl::error::{SslError, StreamError, OpenSslErrors, SslSessionClosed
|
|||||||
use self::HttpStream::{Http, Https};
|
use self::HttpStream::{Http, Https};
|
||||||
|
|
||||||
/// The write-status indicating headers have not been written.
|
/// The write-status indicating headers have not been written.
|
||||||
|
#[allow(missing_copy_implementations)]
|
||||||
pub struct Fresh;
|
pub struct Fresh;
|
||||||
|
|
||||||
/// The write-status indicating headers have been written.
|
/// The write-status indicating headers have been written.
|
||||||
|
#[allow(missing_copy_implementations)]
|
||||||
pub struct Streaming;
|
pub struct Streaming;
|
||||||
|
|
||||||
/// An abstraction to listen for connections on a certain port.
|
/// An abstraction to listen for connections on a certain port.
|
||||||
@@ -236,6 +238,7 @@ impl NetworkStream for HttpStream {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A connector that will produce HttpStreams.
|
/// A connector that will produce HttpStreams.
|
||||||
|
#[allow(missing_copy_implementations)]
|
||||||
pub struct HttpConnector;
|
pub struct HttpConnector;
|
||||||
|
|
||||||
impl NetworkConnector<HttpStream> for HttpConnector {
|
impl NetworkConnector<HttpStream> for HttpConnector {
|
||||||
|
|||||||
@@ -1569,6 +1569,8 @@ impl StatusCode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Copy for StatusCode {}
|
||||||
|
|
||||||
/// Formats the status code, *including* the canonical reason.
|
/// Formats the status code, *including* the canonical reason.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
@@ -1684,7 +1686,7 @@ impl ToPrimitive for StatusCode {
|
|||||||
/// to get the appropriate *category* of status.
|
/// to get the appropriate *category* of status.
|
||||||
///
|
///
|
||||||
/// For HTTP/2.0, the 1xx Informational class is invalid.
|
/// 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 {
|
pub enum StatusClass {
|
||||||
/// 1xx: Informational - Request received, continuing process
|
/// 1xx: Informational - Request received, continuing process
|
||||||
Informational = 100,
|
Informational = 100,
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ use std::fmt;
|
|||||||
use self::HttpVersion::{Http09, Http10, Http11, Http20};
|
use self::HttpVersion::{Http09, Http10, Http11, Http20};
|
||||||
|
|
||||||
/// Represents a version of the HTTP spec.
|
/// Represents a version of the HTTP spec.
|
||||||
#[deriving(PartialEq, PartialOrd)]
|
#[deriving(PartialEq, PartialOrd, Copy)]
|
||||||
pub enum HttpVersion {
|
pub enum HttpVersion {
|
||||||
/// `HTTP/0.9`
|
/// `HTTP/0.9`
|
||||||
Http09,
|
Http09,
|
||||||
|
|||||||
Reference in New Issue
Block a user