style(comments): correct some typos in Rust code comments
This commit is contained in:
committed by
Sean McArthur
parent
6d2bcef272
commit
35825c4614
@@ -43,7 +43,7 @@ async fn proxy(client: HttpClient, req: Request<Body>) -> Result<Response<Body>,
|
||||
println!("req: {:?}", req);
|
||||
|
||||
if Method::CONNECT == req.method() {
|
||||
// Recieved an HTTP request like:
|
||||
// Received an HTTP request like:
|
||||
// ```
|
||||
// CONNECT www.domain.com:443 HTTP/1.1
|
||||
// Host: www.domain.com:443
|
||||
@@ -53,7 +53,7 @@ async fn proxy(client: HttpClient, req: Request<Body>) -> Result<Response<Body>,
|
||||
// When HTTP method is CONNECT we should return an empty body
|
||||
// then we can eventually upgrade the connection and talk a new protocol.
|
||||
//
|
||||
// Note: only after client recieved an empty body with STATUS_OK can the
|
||||
// Note: only after client received an empty body with STATUS_OK can the
|
||||
// connection be upgraded, so we can't return a response inside
|
||||
// `on_upgrade` future.
|
||||
if let Some(addr) = host_addr(req.uri()) {
|
||||
|
||||
@@ -36,7 +36,7 @@ where
|
||||
}
|
||||
|
||||
// Our defaults are chosen for the "majority" case, which usually are not
|
||||
// resource contrained, and so the spec default of 64kb can be too limiting
|
||||
// resource constrained, and so the spec default of 64kb can be too limiting
|
||||
// for performance.
|
||||
const DEFAULT_HTTP2_CONN_WINDOW: u32 = 1024 * 1024 * 5; // 5mb
|
||||
const DEFAULT_HTTP2_STREAM_WINDOW: u32 = 1024 * 1024 * 2; // 2mb
|
||||
@@ -356,7 +356,7 @@ where
|
||||
///
|
||||
/// This is useful to allow running a connection while doing an HTTP
|
||||
/// upgrade. Once the upgrade is completed, the connection would be "done",
|
||||
/// but it is not desired to actally shutdown the IO object. Instead you
|
||||
/// but it is not desired to actually shutdown the IO object. Instead you
|
||||
/// would take it back using `into_parts`.
|
||||
///
|
||||
/// Use [`poll_fn`](https://docs.rs/futures/0.1.25/futures/future/fn.poll_fn.html)
|
||||
|
||||
@@ -775,7 +775,7 @@ mod tests {
|
||||
];
|
||||
|
||||
// Scenarios for IPv6 -> IPv4 fallback require that host can access IPv6 network.
|
||||
// Otherwise, connection to "slow" IPv6 address will error-out immediatelly.
|
||||
// Otherwise, connection to "slow" IPv6 address will error-out immediately.
|
||||
let ipv6_accessible = measure_connect(slow_ipv6_addr()).0;
|
||||
|
||||
for &(hosts, family, timeout, needs_ipv6_access) in scenarios {
|
||||
|
||||
@@ -390,7 +390,7 @@ where
|
||||
// - Meanwhile, the pool Checkout is watching to see if any other
|
||||
// request finishes and tries to insert an idle connection.
|
||||
// - If a new connection is started, but the Checkout wins after
|
||||
// (an idle connection becamse available first), the started
|
||||
// (an idle connection became available first), the started
|
||||
// connection future is spawned into the runtime to complete,
|
||||
// and then be inserted into the pool as an idle connection.
|
||||
let checkout = self.pool.checkout(pool_key.clone());
|
||||
@@ -469,7 +469,7 @@ where
|
||||
// Try to take a "connecting lock".
|
||||
//
|
||||
// If the pool_key is for HTTP/2, and there is already a
|
||||
// connection being estabalished, then this can't take a
|
||||
// connection being established, then this can't take a
|
||||
// second lock. The "connect_to" future is Canceled.
|
||||
let connecting = match pool.connecting(&pool_key, ver) {
|
||||
Some(lock) => lock,
|
||||
|
||||
@@ -55,7 +55,7 @@ pub(super) enum Reservation<T> {
|
||||
pub(super) type Key = Arc<String>;
|
||||
|
||||
struct PoolInner<T> {
|
||||
// A flag that a connection is being estabilished, and the connection
|
||||
// A flag that a connection is being established, and the connection
|
||||
// should be shared. This prevents making multiple HTTP/2 connections
|
||||
// to the same host.
|
||||
connecting: HashSet<Key>,
|
||||
|
||||
@@ -97,7 +97,7 @@ fn conn_reset_after_write() {
|
||||
// has written the second request, and THEN disconnect.
|
||||
//
|
||||
// Not because we expect servers to be jerks, but to trigger
|
||||
// state where we write on an assumedly good connetion, and
|
||||
// state where we write on an assumedly good connection, and
|
||||
// only reset the close AFTER we wrote bytes.
|
||||
try_ready!(sock1.as_mut().unwrap().read(&mut [0u8; 512]));
|
||||
sock1.take();
|
||||
|
||||
@@ -31,7 +31,7 @@ enum Kind {
|
||||
///
|
||||
/// Enforces that the body is not longer than the Content-Length header.
|
||||
Length(u64),
|
||||
/// An Encoder for when neither Content-Length nore Chunked encoding is set.
|
||||
/// An Encoder for when neither Content-Length nor Chunked encoding is set.
|
||||
///
|
||||
/// This is mostly only used with HTTP/1.0 with a length. This kind requires
|
||||
/// the connection to be closed when the body is finished.
|
||||
|
||||
@@ -81,7 +81,7 @@ impl Http1Transaction for Server {
|
||||
let len;
|
||||
let headers_len;
|
||||
|
||||
// Unsafe: both headers_indices and headers are using unitialized memory,
|
||||
// Unsafe: both headers_indices and headers are using uninitialized memory,
|
||||
// but we *never* read any of it until after httparse has assigned
|
||||
// values into it. By not zeroing out the stack memory, this saves
|
||||
// a good ~5% on pipeline benchmarks.
|
||||
@@ -165,7 +165,7 @@ impl Http1Transaction for Server {
|
||||
// https://tools.ietf.org/html/rfc7230#section-3.3.3
|
||||
// If Transfer-Encoding header is present, and 'chunked' is
|
||||
// not the final encoding, and this is a Request, then it is
|
||||
// mal-formed. A server should respond with 400 Bad Request.
|
||||
// malformed. A server should respond with 400 Bad Request.
|
||||
if !is_http_11 {
|
||||
debug!("HTTP/1.0 cannot have Transfer-Encoding header");
|
||||
return Err(Parse::Header);
|
||||
@@ -406,7 +406,7 @@ impl Http1Transaction for Server {
|
||||
debug_assert!(is_name_written);
|
||||
continue 'headers;
|
||||
} else {
|
||||
// we haven't written content-lenght yet!
|
||||
// we haven't written content-length yet!
|
||||
encoder = Encoder::length(len);
|
||||
extend(dst, b"content-length: ");
|
||||
extend(dst, value.as_bytes());
|
||||
@@ -792,7 +792,7 @@ impl Client {
|
||||
// https://tools.ietf.org/html/rfc7230#section-3.3.3
|
||||
// If Transfer-Encoding header is present, and 'chunked' is
|
||||
// not the final encoding, and this is a Request, then it is
|
||||
// mal-formed. A server should respond with 400 Bad Request.
|
||||
// malformed. A server should respond with 400 Bad Request.
|
||||
if inc.version == Version::HTTP_10 {
|
||||
debug!("HTTP/1.0 cannot have Transfer-Encoding header");
|
||||
Err(Parse::Header)
|
||||
|
||||
@@ -37,7 +37,7 @@ pub(super) use self::upgrades::UpgradeableConnection;
|
||||
pub use super::tcp::{AddrIncoming, AddrStream};
|
||||
|
||||
// Our defaults are chosen for the "majority" case, which usually are not
|
||||
// resource contrained, and so the spec default of 64kb can be too limiting
|
||||
// resource constrained, and so the spec default of 64kb can be too limiting
|
||||
// for performance.
|
||||
//
|
||||
// At the same time, a server more often has multiple clients connected, and
|
||||
@@ -504,7 +504,7 @@ where
|
||||
///
|
||||
/// This is useful to allow running a connection while doing an HTTP
|
||||
/// upgrade. Once the upgrade is completed, the connection would be "done",
|
||||
/// but it is not desired to actally shutdown the IO object. Instead you
|
||||
/// but it is not desired to actually shutdown the IO object. Instead you
|
||||
/// would take it back using `into_parts`.
|
||||
///
|
||||
/// Use [`poll_fn`](https://docs.rs/futures/0.1.25/futures/future/fn.poll_fn.html)
|
||||
|
||||
@@ -1240,7 +1240,7 @@ mod dispatch_impl {
|
||||
.uri(&*format!("http://{}/a", addr))
|
||||
.body(Body::empty())
|
||||
.unwrap();
|
||||
// notably, havent read body yet
|
||||
// notably, haven't read body yet
|
||||
client.request(req)
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user