Skip to content

Commit 35825c4

Browse files
polybuildrseanmonstar
authored andcommitted
style(comments): correct some typos in Rust code comments
1 parent 6d2bcef commit 35825c4

File tree

10 files changed

+17
-17
lines changed

10 files changed

+17
-17
lines changed

examples/http_proxy.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ async fn proxy(client: HttpClient, req: Request<Body>) -> Result<Response<Body>,
4343
println!("req: {:?}", req);
4444

4545
if Method::CONNECT == req.method() {
46-
// Recieved an HTTP request like:
46+
// Received an HTTP request like:
4747
// ```
4848
// CONNECT www.domain.com:443 HTTP/1.1
4949
// Host: www.domain.com:443
@@ -53,7 +53,7 @@ async fn proxy(client: HttpClient, req: Request<Body>) -> Result<Response<Body>,
5353
// When HTTP method is CONNECT we should return an empty body
5454
// then we can eventually upgrade the connection and talk a new protocol.
5555
//
56-
// Note: only after client recieved an empty body with STATUS_OK can the
56+
// Note: only after client received an empty body with STATUS_OK can the
5757
// connection be upgraded, so we can't return a response inside
5858
// `on_upgrade` future.
5959
if let Some(addr) = host_addr(req.uri()) {

src/client/conn.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ where
3636
}
3737

3838
// Our defaults are chosen for the "majority" case, which usually are not
39-
// resource contrained, and so the spec default of 64kb can be too limiting
39+
// resource constrained, and so the spec default of 64kb can be too limiting
4040
// for performance.
4141
const DEFAULT_HTTP2_CONN_WINDOW: u32 = 1024 * 1024 * 5; // 5mb
4242
const DEFAULT_HTTP2_STREAM_WINDOW: u32 = 1024 * 1024 * 2; // 2mb
@@ -356,7 +356,7 @@ where
356356
///
357357
/// This is useful to allow running a connection while doing an HTTP
358358
/// upgrade. Once the upgrade is completed, the connection would be "done",
359-
/// but it is not desired to actally shutdown the IO object. Instead you
359+
/// but it is not desired to actually shutdown the IO object. Instead you
360360
/// would take it back using `into_parts`.
361361
///
362362
/// Use [`poll_fn`](https://docs.rs/futures/0.1.25/futures/future/fn.poll_fn.html)

src/client/connect/http.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ mod tests {
775775
];
776776

777777
// Scenarios for IPv6 -> IPv4 fallback require that host can access IPv6 network.
778-
// Otherwise, connection to "slow" IPv6 address will error-out immediatelly.
778+
// Otherwise, connection to "slow" IPv6 address will error-out immediately.
779779
let ipv6_accessible = measure_connect(slow_ipv6_addr()).0;
780780

781781
for &(hosts, family, timeout, needs_ipv6_access) in scenarios {

src/client/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ where
390390
// - Meanwhile, the pool Checkout is watching to see if any other
391391
// request finishes and tries to insert an idle connection.
392392
// - If a new connection is started, but the Checkout wins after
393-
// (an idle connection becamse available first), the started
393+
// (an idle connection became available first), the started
394394
// connection future is spawned into the runtime to complete,
395395
// and then be inserted into the pool as an idle connection.
396396
let checkout = self.pool.checkout(pool_key.clone());
@@ -469,7 +469,7 @@ where
469469
// Try to take a "connecting lock".
470470
//
471471
// If the pool_key is for HTTP/2, and there is already a
472-
// connection being estabalished, then this can't take a
472+
// connection being established, then this can't take a
473473
// second lock. The "connect_to" future is Canceled.
474474
let connecting = match pool.connecting(&pool_key, ver) {
475475
Some(lock) => lock,

src/client/pool.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pub(super) enum Reservation<T> {
5555
pub(super) type Key = Arc<String>;
5656

5757
struct PoolInner<T> {
58-
// A flag that a connection is being estabilished, and the connection
58+
// A flag that a connection is being established, and the connection
5959
// should be shared. This prevents making multiple HTTP/2 connections
6060
// to the same host.
6161
connecting: HashSet<Key>,

src/client/tests.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ fn conn_reset_after_write() {
9797
// has written the second request, and THEN disconnect.
9898
//
9999
// Not because we expect servers to be jerks, but to trigger
100-
// state where we write on an assumedly good connetion, and
100+
// state where we write on an assumedly good connection, and
101101
// only reset the close AFTER we wrote bytes.
102102
try_ready!(sock1.as_mut().unwrap().read(&mut [0u8; 512]));
103103
sock1.take();

src/proto/h1/encode.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ enum Kind {
3131
///
3232
/// Enforces that the body is not longer than the Content-Length header.
3333
Length(u64),
34-
/// An Encoder for when neither Content-Length nore Chunked encoding is set.
34+
/// An Encoder for when neither Content-Length nor Chunked encoding is set.
3535
///
3636
/// This is mostly only used with HTTP/1.0 with a length. This kind requires
3737
/// the connection to be closed when the body is finished.

src/proto/h1/role.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ impl Http1Transaction for Server {
8181
let len;
8282
let headers_len;
8383

84-
// Unsafe: both headers_indices and headers are using unitialized memory,
84+
// Unsafe: both headers_indices and headers are using uninitialized memory,
8585
// but we *never* read any of it until after httparse has assigned
8686
// values into it. By not zeroing out the stack memory, this saves
8787
// a good ~5% on pipeline benchmarks.
@@ -165,7 +165,7 @@ impl Http1Transaction for Server {
165165
// https://tools.ietf.org/html/rfc7230#section-3.3.3
166166
// If Transfer-Encoding header is present, and 'chunked' is
167167
// not the final encoding, and this is a Request, then it is
168-
// mal-formed. A server should respond with 400 Bad Request.
168+
// malformed. A server should respond with 400 Bad Request.
169169
if !is_http_11 {
170170
debug!("HTTP/1.0 cannot have Transfer-Encoding header");
171171
return Err(Parse::Header);
@@ -406,7 +406,7 @@ impl Http1Transaction for Server {
406406
debug_assert!(is_name_written);
407407
continue 'headers;
408408
} else {
409-
// we haven't written content-lenght yet!
409+
// we haven't written content-length yet!
410410
encoder = Encoder::length(len);
411411
extend(dst, b"content-length: ");
412412
extend(dst, value.as_bytes());
@@ -792,7 +792,7 @@ impl Client {
792792
// https://tools.ietf.org/html/rfc7230#section-3.3.3
793793
// If Transfer-Encoding header is present, and 'chunked' is
794794
// not the final encoding, and this is a Request, then it is
795-
// mal-formed. A server should respond with 400 Bad Request.
795+
// malformed. A server should respond with 400 Bad Request.
796796
if inc.version == Version::HTTP_10 {
797797
debug!("HTTP/1.0 cannot have Transfer-Encoding header");
798798
Err(Parse::Header)

src/server/conn.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pub(super) use self::upgrades::UpgradeableConnection;
3737
pub use super::tcp::{AddrIncoming, AddrStream};
3838

3939
// Our defaults are chosen for the "majority" case, which usually are not
40-
// resource contrained, and so the spec default of 64kb can be too limiting
40+
// resource constrained, and so the spec default of 64kb can be too limiting
4141
// for performance.
4242
//
4343
// At the same time, a server more often has multiple clients connected, and
@@ -504,7 +504,7 @@ where
504504
///
505505
/// This is useful to allow running a connection while doing an HTTP
506506
/// upgrade. Once the upgrade is completed, the connection would be "done",
507-
/// but it is not desired to actally shutdown the IO object. Instead you
507+
/// but it is not desired to actually shutdown the IO object. Instead you
508508
/// would take it back using `into_parts`.
509509
///
510510
/// Use [`poll_fn`](https://docs.rs/futures/0.1.25/futures/future/fn.poll_fn.html)

tests/client.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1240,7 +1240,7 @@ mod dispatch_impl {
12401240
.uri(&*format!("http://{}/a", addr))
12411241
.body(Body::empty())
12421242
.unwrap();
1243-
// notably, havent read body yet
1243+
// notably, haven't read body yet
12441244
client.request(req)
12451245
};
12461246

0 commit comments

Comments
 (0)