Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit ac5f023

Browse files
committed
Rust update.
1 parent e83f9a2 commit ac5f023

File tree

10 files changed

+23
-21
lines changed

10 files changed

+23
-21
lines changed

Cargo.toml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
[package]
22
name = "http"
33
version = "0.1.0-pre"
4-
authors = [ "Chris Morgan <[email protected]>" ]
4+
authors = ["Chris Morgan <[email protected]>"]
5+
description = "Obsolete HTTP library"
6+
#documentation =
7+
#homepage =
8+
repository = "https://github.com/chris-morgan/rust-http"
9+
readme = "README.rst"
10+
keywords = ["web", "http", "library"]
11+
license = "MIT/Apache-2.0"
512
build = "codegen/main.rs"
613

714
[features]

codegen/branchify.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub fn branchify(options: &[(&str, &str)], case_sensitive: bool) -> Vec<ParseBra
2727
fn go_down_moses(branch: &mut ParseBranch, mut chariter: Chars, result: &str, case_sensitive: bool) {
2828
match chariter.next() {
2929
Some(c) => {
30-
let first_case = if case_sensitive { c as u8 } else { c.to_ascii().to_uppercase().to_byte() };
30+
let first_case = if case_sensitive { c as u8 } else { c.to_ascii().to_uppercase().as_byte() };
3131
for next_branch in branch.children.iter_mut() {
3232
if next_branch.matches[0] == first_case {
3333
go_down_moses(next_branch, chariter, result, case_sensitive);
@@ -37,7 +37,7 @@ pub fn branchify(options: &[(&str, &str)], case_sensitive: bool) -> Vec<ParseBra
3737
let mut subbranch = ParseBranch::new();
3838
subbranch.matches.push(first_case);
3939
if !case_sensitive {
40-
let second_case = c.to_ascii().to_lowercase().to_byte();
40+
let second_case = c.to_ascii().to_lowercase().as_byte();
4141
if first_case != second_case {
4242
subbranch.matches.push(second_case);
4343
}

codegen/status.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ fn camel_case(msg: &str) -> String {
5959
let mut capitalise = true;
6060
for c in msg[].chars() {
6161
let c = match capitalise {
62-
true => c.to_ascii().to_uppercase().to_char(),
63-
false => c.to_ascii().to_lowercase().to_char(),
62+
true => c.to_ascii().to_uppercase().as_char(),
63+
false => c.to_ascii().to_lowercase().as_char(),
6464
};
6565
// For a space, capitalise the next char
6666
capitalise = c == ' ';
@@ -166,7 +166,7 @@ pub mod status {
166166
use std::fmt;
167167
use std::ascii::AsciiExt;
168168
169-
use self::Status::*;
169+
pub use self::Status::*;
170170
171171
/// HTTP status code
172172
#[deriving(Eq, PartialEq, Clone)]

examples/request_uri.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use std::io::net::ip::{SocketAddr, Ipv4Addr};
1313
use std::io::Writer;
1414

1515
use http::server::{Config, Server, Request, ResponseWriter};
16-
use http::server::request::{Star, AbsoluteUri, AbsolutePath, Authority};
16+
use http::server::request::RequestUri::{Star, AbsoluteUri, AbsolutePath, Authority};
1717
use http::status::{BadRequest, MethodNotAllowed};
1818
use http::method::{Get, Head, Post, Put, Delete, Trace, Options, Connect, Patch};
1919
use http::headers::content_type::MediaType;

src/http/client/sslclients/openssl.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ extern crate openssl;
66
use std::io::net::ip::SocketAddr;
77
use std::io::net::tcp::TcpStream;
88
use std::io::{IoResult, IoError, ConnectionAborted, OtherIoError};
9-
use self::openssl::ssl::{SslStream, SslContext, Sslv23, Ssl};
9+
use self::openssl::ssl::{SslStream, SslContext, SslMethod, Ssl};
1010
use self::openssl::ssl::error::{SslError, StreamError, SslSessionClosed, OpenSslErrors};
1111
use self::NetworkStream::{NormalStream, SslProtectedStream};
1212
use connecter::Connecter;
@@ -23,7 +23,7 @@ impl Connecter for NetworkStream {
2323
fn connect(addr: SocketAddr, host: &str, use_ssl: bool) -> IoResult<NetworkStream> {
2424
let stream = try!(TcpStream::connect(addr));
2525
if use_ssl {
26-
let context = try!(SslContext::new(Sslv23).map_err(lift_ssl_error));
26+
let context = try!(SslContext::new(SslMethod::Sslv23).map_err(lift_ssl_error));
2727
let ssl = try!(Ssl::new(&context).map_err(lift_ssl_error));
2828
try!(ssl.set_hostname(host).map_err(lift_ssl_error));
2929
let ssl_stream = try!(SslStream::new_from(ssl, stream).map_err(lift_ssl_error));

src/http/headers/accept_ranges.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
use std::io::IoResult;
44
use std::ascii::AsciiExt;
55

6-
use self::AcceptableRanges::{RangeUnits, NoAcceptableRanges};
7-
use self::RangeUnit::{Bytes, OtherRangeUnit};
6+
pub use self::AcceptableRanges::{RangeUnits, NoAcceptableRanges};
7+
pub use self::RangeUnit::{Bytes, OtherRangeUnit};
88

99
#[deriving(Clone, PartialEq, Eq)]
1010
// RFC 2616: range-unit = bytes-unit | other-range-unit

src/http/headers/serialization_utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ pub fn normalise_header_name(name: &String) -> String {
2828
true => c.to_ascii().to_uppercase(),
2929
false => c.to_ascii().to_lowercase(),
3030
};
31-
result.push(c.to_char());
31+
result.push(c.as_char());
3232
// ASCII 45 is '-': in that case, capitalise the next char
33-
capitalise = c.to_byte() == 45;
33+
capitalise = c.as_byte() == 45;
3434
}
3535
result
3636
}

src/http/headers/transfer_encoding.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::ascii::AsciiExt;
66
use std::io::IoResult;
77
use headers::serialization_utils::{WriterUtil, push_parameters};
88

9-
use self::TransferCoding::{Chunked, TransferExtension};
9+
pub use self::TransferCoding::{Chunked, TransferExtension};
1010

1111
/// RFC 2616, section 3.6:
1212
///

src/http/lib.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
#![crate_name = "http"]
22

3-
#![comment = "Rust HTTP server"]
4-
#![license = "MIT/ASL2"]
5-
#![crate_type = "dylib"]
6-
#![crate_type = "rlib"]
7-
83
#![doc(html_root_url = "http://www.rust-ci.org/chris-morgan/rust-http/doc/")]
94

105
#![deny(non_camel_case_types)]

src/http/method.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use std::fmt;
22
use std::str::FromStr;
33

4-
use self::Method::{Options, Get, Head, Post, Put, Delete, Trace,
5-
Connect, Patch, ExtensionMethod};
4+
pub use self::Method::{Options, Get, Head, Post, Put, Delete, Trace,
5+
Connect, Patch, ExtensionMethod};
66

77
/// HTTP methods, as defined in RFC 2616, §5.1.1.
88
///

0 commit comments

Comments
 (0)