feat(lib): switch to non-blocking (asynchronous) IO

BREAKING CHANGE: This breaks a lot of the Client and Server APIs.
  Check the documentation for how Handlers can be used for asynchronous
  events.
This commit is contained in:
Sean McArthur
2016-05-03 20:45:43 -07:00
parent 1ec56fe6b6
commit d35992d019
65 changed files with 5599 additions and 5023 deletions

View File

@@ -1,4 +1,4 @@
use header::{Header, HeaderFormat};
use header::{Header};
use std::fmt;
use header::parsing::from_one_raw_str;
@@ -52,9 +52,7 @@ impl Header for Host {
// https://github.com/servo/rust-url/issues/42
let idx = {
let slice = &s[..];
let mut chars = slice.chars();
chars.next();
if chars.next().unwrap() == '[' {
if slice.starts_with('[') {
match slice.rfind(']') {
Some(idx) => {
if slice.len() > idx + 2 {
@@ -86,9 +84,7 @@ impl Header for Host {
})
})
}
}
impl HeaderFormat for Host {
fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self.port {
None | Some(80) | Some(443) => f.write_str(&self.hostname[..]),