From 2fa414fb5fe6dbc922da25cca9960652edf32591 Mon Sep 17 00:00:00 2001 From: Julian Tescher Date: Tue, 7 Feb 2017 11:04:42 -0800 Subject: [PATCH] fix(lib): Fixed typos in multiple modules BREAKING CHANGE: The `Preference` header had a typo in a variant and it's string representation, change `Preference::HandlingLeniant` to `Preference::HandlingLenient`. --- src/client/request.rs | 2 +- src/header/common/access_control_allow_origin.rs | 2 +- src/header/common/content_location.rs | 2 +- src/header/common/last-event-id.rs | 2 +- src/header/common/origin.rs | 2 +- src/header/common/prefer.rs | 12 ++++++------ src/header/common/upgrade.rs | 2 +- src/header/mod.rs | 2 +- src/header/shared/quality_item.rs | 2 +- src/http/buf.rs | 2 +- src/http/conn.rs | 2 +- src/http/h1/mod.rs | 4 ++-- src/http/h1/parse.rs | 4 ++-- tests/client.rs | 2 +- tests/server.rs | 2 +- 15 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/client/request.rs b/src/client/request.rs index 9f393ee84a..79f708e2cd 100644 --- a/src/client/request.rs +++ b/src/client/request.rs @@ -34,7 +34,7 @@ impl Request { #[inline] pub fn url(&self) -> &Url { &self.url } - /// Readthe Request Version. + /// Read the Request Version. #[inline] pub fn version(&self) -> &HttpVersion { &self.version } diff --git a/src/header/common/access_control_allow_origin.rs b/src/header/common/access_control_allow_origin.rs index 0de165927f..9b1518ac7a 100644 --- a/src/header/common/access_control_allow_origin.rs +++ b/src/header/common/access_control_allow_origin.rs @@ -88,7 +88,7 @@ impl Display for AccessControlAllowOrigin { } #[cfg(test)] -mod test_access_control_allow_orgin { +mod test_access_control_allow_origin { use header::*; use super::AccessControlAllowOrigin as HeaderField; test_header!(test1, vec![b"null"]); diff --git a/src/header/common/content_location.rs b/src/header/common/content_location.rs index 1b3eb8b47c..75c0c8c9fa 100644 --- a/src/header/common/content_location.rs +++ b/src/header/common/content_location.rs @@ -3,7 +3,7 @@ header! { /// [RFC7231](https://tools.ietf.org/html/rfc7231#section-3.1.4.2) /// /// The header can be used by both the client in requests and the server - /// in resposes with different semantics. Client sets `Content-Location` + /// in responses with different semantics. Client sets `Content-Location` /// to refer to the URI where original representation of the body was /// obtained. /// diff --git a/src/header/common/last-event-id.rs b/src/header/common/last-event-id.rs index 2c82d36342..f89c249c70 100644 --- a/src/header/common/last-event-id.rs +++ b/src/header/common/last-event-id.rs @@ -7,7 +7,7 @@ header! { /// track of event state. This is helpful when working /// with [Server-Sent-Events](http://www.html5rocks.com/en/tutorials/eventsource/basics/). If the connection were to be dropped, for example, it'd /// be useful to let the server know what the last event you - /// recieved was. + /// received was. /// /// The spec is a String with the id of the last event, it can be /// an empty string which acts a sort of "reset". diff --git a/src/header/common/origin.rs b/src/header/common/origin.rs index 82bb346ef3..985972b2d6 100644 --- a/src/header/common/origin.rs +++ b/src/header/common/origin.rs @@ -71,7 +71,7 @@ impl FromStr for Origin { Some(idx) => idx, None => return Err(::Error::Header) }; - // idx + 3 because thats how long "://" is + // idx + 3 because that's how long "://" is let (scheme, etc) = (&s[..idx], &s[idx + 3..]); let host = try!(Host::from_str(etc)); diff --git a/src/header/common/prefer.rs b/src/header/common/prefer.rs index 856d02c056..c9a7e5dac0 100644 --- a/src/header/common/prefer.rs +++ b/src/header/common/prefer.rs @@ -87,8 +87,8 @@ pub enum Preference { ReturnMinimal, /// "handling=strict" HandlingStrict, - /// "handling=leniant" - HandlingLeniant, + /// "handling=lenient" + HandlingLenient, /// "wait=delta" Wait(u32), @@ -105,7 +105,7 @@ impl fmt::Display for Preference { ReturnRepresentation => "return=representation", ReturnMinimal => "return=minimal", HandlingStrict => "handling=strict", - HandlingLeniant => "handling=leniant", + HandlingLenient => "handling=lenient", Wait(secs) => return write!(f, "wait={}", secs), @@ -148,7 +148,7 @@ impl FromStr for Preference { ("return", "representation") => if rest.is_empty() { Ok(ReturnRepresentation) } else { Err(None) }, ("return", "minimal") => if rest.is_empty() { Ok(ReturnMinimal) } else { Err(None) }, ("handling", "strict") => if rest.is_empty() { Ok(HandlingStrict) } else { Err(None) }, - ("handling", "leniant") => if rest.is_empty() { Ok(HandlingLeniant) } else { Err(None) }, + ("handling", "lenient") => if rest.is_empty() { Ok(HandlingLenient) } else { Err(None) }, ("wait", secs) => if rest.is_empty() { secs.parse().map(Wait).map_err(Some) } else { Err(None) }, (left, right) => Ok(Extension(left.to_owned(), right.to_owned(), rest)) } @@ -172,9 +172,9 @@ mod tests { #[test] fn test_parse_argument() { - let prefer = Header::parse_header(&"wait=100, handling=leniant, respond-async".into()); + let prefer = Header::parse_header(&"wait=100, handling=lenient, respond-async".into()); assert_eq!(prefer.ok(), Some(Prefer(vec![Preference::Wait(100), - Preference::HandlingLeniant, + Preference::HandlingLenient, Preference::RespondAsync]))) } diff --git a/src/header/common/upgrade.rs b/src/header/common/upgrade.rs index 782ca018fd..d0b3737ff8 100644 --- a/src/header/common/upgrade.rs +++ b/src/header/common/upgrade.rs @@ -74,7 +74,7 @@ header! { } } -/// A protocol name used to identify a spefic protocol. Names are case-sensitive +/// A protocol name used to identify a specific protocol. Names are case-sensitive /// except for the `WebSocket` value. #[derive(Clone, Debug, Eq, PartialEq)] pub enum ProtocolName { diff --git a/src/header/mod.rs b/src/header/mod.rs index 127cef05b1..ab5027b4ba 100644 --- a/src/header/mod.rs +++ b/src/header/mod.rs @@ -476,7 +476,7 @@ impl Headers { /// /// If a header already contains a value, this will add another line to it. /// - /// If a header doesnot exist for this name, a new one will be created with + /// If a header does not exist for this name, a new one will be created with /// the value. /// /// Example: diff --git a/src/header/shared/quality_item.rs b/src/header/shared/quality_item.rs index 70089e4d8b..e3cb7a27e4 100644 --- a/src/header/shared/quality_item.rs +++ b/src/header/shared/quality_item.rs @@ -114,7 +114,7 @@ fn from_f32(f: f32) -> Quality { Quality((f * 1000f32) as u16) } -/// Convinience function to wrap a value in a `QualityItem` +/// Convenience function to wrap a value in a `QualityItem` /// Sets `q` to the default 1.0 pub fn qitem(item: T) -> QualityItem { QualityItem::new(item, Default::default()) diff --git a/src/http/buf.rs b/src/http/buf.rs index f31a468097..29c72f1e5b 100644 --- a/src/http/buf.rs +++ b/src/http/buf.rs @@ -91,7 +91,7 @@ impl MemBuf { grow_zerofill(vec, needed); } } else { - // we need to allocate more space, but dont have unique + // we need to allocate more space, but don't have unique // access, so we need to make a new buffer trace!("MemBuf::reserve shared buffer, creating new"); let mut new = MemBuf::with_capacity(needed); diff --git a/src/http/conn.rs b/src/http/conn.rs index 7954fadb8a..c54f4c81c3 100644 --- a/src/http/conn.rs +++ b/src/http/conn.rs @@ -524,7 +524,7 @@ impl State { } // The DebugFrame and DebugChunk are simple Debug implementations that allow -// us to dump the frame into logs, wihtout logging the entirety of the bytes. +// us to dump the frame into logs, without logging the entirety of the bytes. struct DebugFrame<'a, T: fmt::Debug + 'a>(&'a Frame, http::Chunk, ::Error>); impl<'a, T: fmt::Debug + 'a> fmt::Debug for DebugFrame<'a, T> { diff --git a/src/http/h1/mod.rs b/src/http/h1/mod.rs index 11c7588a17..121014445d 100644 --- a/src/http/h1/mod.rs +++ b/src/http/h1/mod.rs @@ -72,7 +72,7 @@ impl HttpMessage for Http11Message { let is_empty = !should_have_response_body(&method, raw_status.0); stream.get_mut().set_previous_response_expected_no_content(is_empty); // According to https://tools.ietf.org/html/rfc7230#section-3.3.3 - // 1. HEAD reponses, and Status 1xx, 204, and 304 cannot have a body. + // 1. HEAD responses, and Status 1xx, 204, and 304 cannot have a body. // 2. Status 2xx to a CONNECT cannot have a body. // 3. Transfer-Encoding: chunked has a chunked body. // 4. If multiple differing Content-Length headers or invalid, close connection. @@ -86,7 +86,7 @@ impl HttpMessage for Http11Message { if codings.last() == Some(&Chunked) { ChunkedReader(stream, None) } else { - trace!("not chuncked. read till eof"); + trace!("not chunked. read till eof"); EofReader(stream) } } else if let Some(&ContentLength(len)) = headers.get() { diff --git a/src/http/h1/parse.rs b/src/http/h1/parse.rs index f59d64efe8..1170e92644 100644 --- a/src/http/h1/parse.rs +++ b/src/http/h1/parse.rs @@ -150,7 +150,7 @@ impl Http1Transaction for ClientTransaction { fn decoder(inc: &MessageHead) -> ::Result { use ::header; // According to https://tools.ietf.org/html/rfc7230#section-3.3.3 - // 1. HEAD reponses, and Status 1xx, 204, and 304 cannot have a body. + // 1. HEAD responses, and Status 1xx, 204, and 304 cannot have a body. // 2. Status 2xx to a CONNECT cannot have a body. // // First two steps taken care of before this method. @@ -164,7 +164,7 @@ impl Http1Transaction for ClientTransaction { if codings.last() == Some(&header::Encoding::Chunked) { Ok(Decoder::chunked()) } else { - trace!("not chuncked. read till eof"); + trace!("not chunked. read till eof"); Ok(Decoder::eof()) } } else if let Some(&header::ContentLength(len)) = inc.headers.get() { diff --git a/tests/client.rs b/tests/client.rs index 8da80e7ba7..233f009b3d 100644 --- a/tests/client.rs +++ b/tests/client.rs @@ -232,7 +232,7 @@ fn client_keep_alive() { } -/* TODO: re-enable once rety works, its currently a flaky test +/* TODO: re-enable once retry works, its currently a flaky test #[test] fn client_pooled_socket_disconnected() { let _ = pretty_env_logger::init(); diff --git a/tests/server.rs b/tests/server.rs index ad05f97519..c2d9c80318 100644 --- a/tests/server.rs +++ b/tests/server.rs @@ -212,7 +212,7 @@ fn server_get_with_body() { ").unwrap(); req.read(&mut [0; 256]).unwrap(); - // note: doesnt include trailing \r\n, cause Content-Length wasn't 21 + // note: doesn't include trailing \r\n, cause Content-Length wasn't 21 assert_eq!(server.body(), b"I'm a good request."); }