Skip to content

Commit

Permalink
fix(lib): Fixed typos in multiple modules
Browse files Browse the repository at this point in the history
BREAKING CHANGE: The `Preference` header had a typo in a variant and it's string representation,
  change `Preference::HandlingLeniant` to `Preference::HandlingLenient`.
  • Loading branch information
jtescher authored and seanmonstar committed Feb 7, 2017
1 parent 0d05533 commit 2fa414f
Show file tree
Hide file tree
Showing 15 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/client/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 }

Expand Down
2 changes: 1 addition & 1 deletion src/header/common/access_control_allow_origin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"]);
Expand Down
2 changes: 1 addition & 1 deletion src/header/common/content_location.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down
2 changes: 1 addition & 1 deletion src/header/common/last-event-id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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".
Expand Down
2 changes: 1 addition & 1 deletion src/header/common/origin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down
12 changes: 6 additions & 6 deletions src/header/common/prefer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ pub enum Preference {
ReturnMinimal,
/// "handling=strict"
HandlingStrict,
/// "handling=leniant"
HandlingLeniant,
/// "handling=lenient"
HandlingLenient,
/// "wait=delta"
Wait(u32),

Expand All @@ -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),

Expand Down Expand Up @@ -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))
}
Expand All @@ -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])))
}

Expand Down
2 changes: 1 addition & 1 deletion src/header/common/upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/header/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion src/header/shared/quality_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T>(item: T) -> QualityItem<T> {
QualityItem::new(item, Default::default())
Expand Down
2 changes: 1 addition & 1 deletion src/http/buf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/http/conn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ impl<K: KeepAlive> State<K> {
}

// 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::MessageHead<T>, http::Chunk, ::Error>);

impl<'a, T: fmt::Debug + 'a> fmt::Debug for DebugFrame<'a, T> {
Expand Down
4 changes: 2 additions & 2 deletions src/http/h1/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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() {
Expand Down
4 changes: 2 additions & 2 deletions src/http/h1/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ impl Http1Transaction for ClientTransaction {
fn decoder(inc: &MessageHead<Self::Incoming>) -> ::Result<Decoder> {
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.
Expand All @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion tests/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion tests/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
}

Expand Down

0 comments on commit 2fa414f

Please sign in to comment.