rustup
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
#![feature(macro_rules, phase, default_type_params, if_let, slicing_syntax,
|
||||
tuple_indexing, globs)]
|
||||
#![feature(macro_rules, phase, default_type_params, slicing_syntax, globs)]
|
||||
#![deny(missing_docs)]
|
||||
#![deny(warnings)]
|
||||
#![experimental]
|
||||
|
||||
@@ -15,8 +15,6 @@ use http::HttpReader;
|
||||
use http::HttpReader::{SizedReader, ChunkedReader, EmptyReader};
|
||||
use uri::RequestUri;
|
||||
|
||||
pub type InternalReader<'a> = &'a mut (Reader + 'a);
|
||||
|
||||
/// A request bundles several parts of an incoming `NetworkStream`, given to a `Handler`.
|
||||
pub struct Request<'a> {
|
||||
/// The IP address of the remote connection.
|
||||
@@ -29,7 +27,7 @@ pub struct Request<'a> {
|
||||
pub uri: RequestUri,
|
||||
/// The version of HTTP for this request.
|
||||
pub version: HttpVersion,
|
||||
body: HttpReader<InternalReader<'a>>
|
||||
body: HttpReader<&'a mut (Reader + 'a)>
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +35,7 @@ impl<'a> Request<'a> {
|
||||
|
||||
/// Create a new Request, reading the StartLine and Headers so they are
|
||||
/// immediately useful.
|
||||
pub fn new(mut stream: InternalReader<'a>, addr: SocketAddr) -> HttpResult<Request<'a>> {
|
||||
pub fn new(mut stream: &'a mut (Reader + 'a), addr: SocketAddr) -> HttpResult<Request<'a>> {
|
||||
let (method, uri, version) = try!(read_request_line(&mut stream));
|
||||
debug!("Request Line: {} {} {}", method, uri, version);
|
||||
let headers = try!(Headers::from_raw(&mut stream));
|
||||
|
||||
@@ -14,14 +14,12 @@ use status;
|
||||
use net::{Fresh, Streaming};
|
||||
use version;
|
||||
|
||||
pub type InternalWriter<'a> = &'a mut (Writer + 'a);
|
||||
|
||||
/// The outgoing half for a Tcp connection, created by a `Server` and given to a `Handler`.
|
||||
pub struct Response<'a, W = Fresh> {
|
||||
/// The HTTP version of this response.
|
||||
pub version: version::HttpVersion,
|
||||
// Stream the Response is writing to, not accessible through UnwrittenResponse
|
||||
body: HttpWriter<InternalWriter<'a>>,
|
||||
body: HttpWriter<&'a mut (Writer + 'a)>,
|
||||
// The status code for the request.
|
||||
status: status::StatusCode,
|
||||
// The outgoing headers on this response.
|
||||
@@ -38,7 +36,7 @@ impl<'a, W> Response<'a, W> {
|
||||
|
||||
/// Construct a Response from its constituent parts.
|
||||
pub fn construct(version: version::HttpVersion,
|
||||
body: HttpWriter<InternalWriter<'a>>,
|
||||
body: HttpWriter<&'a mut (Writer + 'a)>,
|
||||
status: status::StatusCode,
|
||||
headers: header::Headers) -> Response<'a, Fresh> {
|
||||
Response {
|
||||
@@ -50,7 +48,7 @@ impl<'a, W> Response<'a, W> {
|
||||
}
|
||||
|
||||
/// Deconstruct this Response into its constituent parts.
|
||||
pub fn deconstruct(self) -> (version::HttpVersion, HttpWriter<InternalWriter<'a>>,
|
||||
pub fn deconstruct(self) -> (version::HttpVersion, HttpWriter<&'a mut (Writer + 'a)>,
|
||||
status::StatusCode, header::Headers) {
|
||||
(self.version, self.body, self.status, self.headers)
|
||||
}
|
||||
@@ -58,7 +56,7 @@ impl<'a, W> Response<'a, W> {
|
||||
|
||||
impl<'a> Response<'a, Fresh> {
|
||||
/// Creates a new Response that can be used to write to a network stream.
|
||||
pub fn new(stream: InternalWriter<'a>) -> Response<'a, Fresh> {
|
||||
pub fn new(stream: &'a mut (Writer + 'a)) -> Response<'a, Fresh> {
|
||||
Response {
|
||||
status: status::StatusCode::Ok,
|
||||
version: version::HttpVersion::Http11,
|
||||
|
||||
Reference in New Issue
Block a user