diff options
39 files changed, 70 insertions, 70 deletions
@@ -1 +1 @@ -fec326a416d91d8d1d5b7a165ba371c478c1e278
\ No newline at end of file +39f0cfd032dab4ed6a064873c44b7f96a7710df4
\ No newline at end of file @@ -17,31 +17,31 @@ Pingora is battle tested as it has been serving more than 40 million Internet re * Support for a variety of observability tools ## Reasons to use Pingora -* **Security** is your top priority: Pingora is a more memory safe alternative for services that are written in C/C++. -* Your service is **performance-sensitive**: Pingora is fast and efficient. -* Your service requires extensive **customization**: The APIs Pingora proxy framework provides are highly programmable. +* **Security** is your top priority: Pingora is a more memory safe alternative for services that are written in C/C++ +* Your service is **performance-sensitive**: Pingora is fast and efficient +* Your service requires extensive **customization**: The APIs Pingora proxy framework provides are highly programmable # Getting started See our [quick starting guide](./docs/quick_start.md) to see how easy it is to build a load balancer. -Our [user guide](./docs/user_guide/index.md) covers more topics such as how to configure and run Pingora servers, as well as how to build custom HTTP server and proxy logic on top of Pingora's framework. +Our [user guide](./docs/user_guide/index.md) covers more topics such as how to configure and run Pingora servers, as well as how to build custom HTTP servers and proxy logic on top of Pingora's framework. API docs are also available for all the crates. # Notable crates in this workspace -* Pingora: the "public facing" crate to build to build networked systems and proxies. -* Pingora-core: this crates defined the protocols, functionalities and basic traits. -* Pingora-proxy: the logic and APIs to build HTTP proxies. +* Pingora: the "public facing" crate to build networked systems and proxies +* Pingora-core: this crate defines the protocols, functionalities and basic traits +* Pingora-proxy: the logic and APIs to build HTTP proxies * Pingora-error: the common error type used across Pingora crates * Pingora-http: the HTTP header definitions and APIs * Pingora-openssl & pingora-boringssl: SSL related extensions and APIs * Pingora-ketama: the [Ketama](https://github.com/RJ/ketama) consistent algorithm * Pingora-limits: efficient counting algorithms -* Pingora-load-balancing: load balancing algorithm extensions for pingora proxy -* Pingora-memory-cache: Async in-memory caching with cache lock to prevent cache stampede. -* Pingora-timeout: A more efficient async timer system. -* TinyUfo: The caching algorithm behind pingora-memory-cache. +* Pingora-load-balancing: load balancing algorithm extensions for pingora-proxy +* Pingora-memory-cache: Async in-memory caching with cache lock to prevent cache stampede +* Pingora-timeout: A more efficient async timer system +* TinyUfo: The caching algorithm behind pingora-memory-cache # System requirements diff --git a/docs/quick_start.md b/docs/quick_start.md index c59add2..2c5ada8 100644 --- a/docs/quick_start.md +++ b/docs/quick_start.md @@ -187,7 +187,7 @@ fn main() { } ``` -Now if we run our loud balancer again with `cargo run`, and test it with +Now if we run our load balancer again with `cargo run`, and test it with ``` curl 127.0.0.1:6188 -svo /dev/null @@ -297,7 +297,7 @@ Now you can find the pid of the service. ### Gracefully upgrade the service (Linux only) -Let's say we changed the code of the load balancer, recompiled the binary. Now we want to upgrade the service running in the background to this newer version. +Let's say we changed the code of the load balancer and recompiled the binary. Now we want to upgrade the service running in the background to this newer version. If we simply stop the old service, then start the new one, some request arriving in between could be lost. Fortunately, Pingora provides a graceful way to upgrade the service. diff --git a/docs/user_guide/conf.md b/docs/user_guide/conf.md index 6e13609..a9a217b 100644 --- a/docs/user_guide/conf.md +++ b/docs/user_guide/conf.md @@ -27,7 +27,7 @@ group: webusers | client_bind_to_ipv6 | source IPv6 addresses to bind to when connecting to server| list of string | | ca_file | The path to the root CA file | string | | work_stealing | Enable work stealing runtime (default true). See Pingora runtime (WIP) section for more info | bool | -| upstream_keepalive_pool_size | The number of total connections to keep in the connetion pool | number | +| upstream_keepalive_pool_size | The number of total connections to keep in the connection pool | number | ## Extension Any unknown settings will be ignored. This allows extending the conf file to add and pass user defined settings. See User defined configuration section. diff --git a/docs/user_guide/error_log.md b/docs/user_guide/error_log.md index 6dd0830..f9d9c0a 100644 --- a/docs/user_guide/error_log.md +++ b/docs/user_guide/error_log.md @@ -6,7 +6,7 @@ Pingora libraries are built to expect issues like disconnects, timeouts and inva Pingora adopts the idea behind [log](https://docs.rs/log/latest/log/). There are five log levels: * `error`: This level should be used when the error stops the request from being handled correctly. For example when the server we try to connect to is offline. * `warning`: This level should be used when an error occurs but the system recovers from it. For example when the primary DNS timed out but the system is able to query the secondary DNS. -* `info`: Pingora logs when the server is starting up or shuting down. +* `info`: Pingora logs when the server is starting up or shutting down. * `debug`: Internal details. This log level is not compiled in `release` builds. * `trace`: Fine-grained internal details. This log level is not compiled in `release` builds. diff --git a/docs/user_guide/graceful.md b/docs/user_guide/graceful.md index 1f67aa3..5bb6709 100644 --- a/docs/user_guide/graceful.md +++ b/docs/user_guide/graceful.md @@ -1,6 +1,6 @@ # Graceful restart and shutdown -Graceful restart, upgrade, and shutdown mechanisms are very commonly used to avoid errors or downtime when releasing new versions of pingora servers. +Graceful restart, upgrade, and shutdown mechanisms are very commonly used to avoid errors or downtime when releasing new versions of Pingora servers. Pingora graceful upgrade mechanism guarantees the following: * A request is guaranteed to be handled either by the old server instance or the new one. No request will see connection refused when trying to connect to the server endpoints. @@ -11,7 +11,7 @@ Pingora graceful upgrade mechanism guarantees the following: Configure the upgrade socket. The old and new server need to agree on the same path to this socket. See configuration manual for details. ### Step 1 -Start the new instance with the `--upgrade` cli option. The new instance will not try to listen to the service endpoint right away. It will try to acquire the listening socket from the old instance instead. +Start the new instance with the `--upgrade` CLI option. The new instance will not try to listen to the service endpoint right away. It will try to acquire the listening socket from the old instance instead. ### Step 2 Send SIGQUIT signal to the old instance. The old instance will start to transfer the listening socket to the new instance. diff --git a/docs/user_guide/internals.md b/docs/user_guide/internals.md index 0655379..4decbbf 100644 --- a/docs/user_guide/internals.md +++ b/docs/user_guide/internals.md @@ -132,7 +132,7 @@ For example, this is how an `HttpProxy` struct, from the `pingora-proxy` crate, └─────────────────────┘ ``` -Different functionality and helpers are provided at different layers in this representation. +Different functionalities and helpers are provided at different layers in this representation. ``` ┌─────────────┐ ┌──────────────────────────────────────┐ diff --git a/docs/user_guide/peer.md b/docs/user_guide/peer.md index 1176d14..3b5e1de 100644 --- a/docs/user_guide/peer.md +++ b/docs/user_guide/peer.md @@ -22,7 +22,7 @@ A `PeerOptions` defines how to connect to the upstream. |connection_timeout: `Option<Duration>`| How long to wait before giving up *establishing* a TCP connection | |total_connection_timeout: `Option<Duration>`| How long to wait before giving up *establishing* a connection including TLS handshake time | |read_timeout: `Option<Duration>`| How long to wait before each individual `read()` from upstream. The timer is reset after each `read()` | -|idle_timeout: `Option<Duration>`| How long to wait before closing a idle connection waiting for connetion reuse | +|idle_timeout: `Option<Duration>`| How long to wait before closing a idle connection waiting for connection reuse | |write_timeout: `Option<Duration>`| How long to wait before a `write()` to upstream finishes | |verify_cert: `bool`| Whether to check if upstream' server cert is valid and validated | |verify_hostname: `bool`| Whether to check if upstream server cert's CN matches the SNI | diff --git a/docs/user_guide/start_stop.md b/docs/user_guide/start_stop.md index 2c2a585..6e26981 100644 --- a/docs/user_guide/start_stop.md +++ b/docs/user_guide/start_stop.md @@ -1,4 +1,4 @@ -# Starting and stoping Pingora server +# Starting and stopping Pingora server A pingora server is a regular unprivileged multithreaded process. @@ -11,7 +11,7 @@ A Pingora server by default takes the following command-line arguments: | ------------- |-------------| ----| | -d, --daemon | Daemonize the server | false | | -t, --test | Test the server conf and then exit (WIP) | false | -| -c, --conf | The path to the configuarion file | empty string | +| -c, --conf | The path to the configuration file | empty string | | -u, --upgrade | This server should gracefully upgrade a running server | false | ## Stop @@ -24,4 +24,4 @@ Upon receiving SIGINT (ctrl + c), the server will exit immediately with no delay Upon receiving SIGTERM, the server will notify all its services to shutdown, wait for some preconfigured time and then exit. This behavior gives requests a grace period to finish. ### SIGQUIT: graceful upgrade -Similar to SIGQUIT, but the server will also transfer all its listening sockets to a new Pingora server so that there is no downtime during the upgrade. See the [graceful upgrade](graceful.md) section for more details. +Similar to SIGTERM, but the server will also transfer all its listening sockets to a new Pingora server so that there is no downtime during the upgrade. See the [graceful upgrade](graceful.md) section for more details. diff --git a/pingora-cache/src/eviction/lru.rs b/pingora-cache/src/eviction/lru.rs index 47c88a6..35ceb77 100644 --- a/pingora-cache/src/eviction/lru.rs +++ b/pingora-cache/src/eviction/lru.rs @@ -32,7 +32,7 @@ use std::time::SystemTime; /// /// - Space optimized in-memory LRU (see [pingora_lru]). /// - Instead of a single giant LRU, this struct shards the assets into `N` independent LRUs. -/// This allows [EvictionManager::save()] not to lock the entire cache mananger while performing +/// This allows [EvictionManager::save()] not to lock the entire cache manager while performing /// serialization. pub struct Manager<const N: usize>(Lru<CompactCacheKey, N>); diff --git a/pingora-cache/src/eviction/mod.rs b/pingora-cache/src/eviction/mod.rs index 7c9d60b..bb32c62 100644 --- a/pingora-cache/src/eviction/mod.rs +++ b/pingora-cache/src/eviction/mod.rs @@ -29,9 +29,9 @@ pub mod simple_lru; /// be handled the implementations internally. #[async_trait] pub trait EvictionManager { - /// Total size of the cache in bytes tracked by this eviction mananger + /// Total size of the cache in bytes tracked by this eviction manager fn total_size(&self) -> usize; - /// Number of assets tracked by this eviction mananger + /// Number of assets tracked by this eviction manager fn total_items(&self) -> usize; /// Number of bytes that are already evicted /// @@ -76,7 +76,7 @@ pub trait EvictionManager { /// method shouldn't change the popularity of the asset being peeked. fn peek(&self, item: &CompactCacheKey) -> bool; - /// Serialize to save the state of this eviction mananger to disk + /// Serialize to save the state of this eviction manager to disk /// /// This function is for preserving the eviction manager's state across server restarts. /// diff --git a/pingora-cache/src/filters.rs b/pingora-cache/src/filters.rs index 8293cb5..4255673 100644 --- a/pingora-cache/src/filters.rs +++ b/pingora-cache/src/filters.rs @@ -187,7 +187,7 @@ pub mod upstream { // remove downstream range header as we'd like to cache the entire response (this might change in the future) req.remove_header(&header::RANGE); - // we have a persumably staled response already, add precondition headers for revalidation + // we have a presumably staled response already, add precondition headers for revalidation if let Some(m) = meta { // rfc7232: "SHOULD send both validators in cache validation" but // there have been weird cases that an origin has matching etag but not Last-Modified diff --git a/pingora-cache/src/lib.rs b/pingora-cache/src/lib.rs index be352dc..2bf0b92 100644 --- a/pingora-cache/src/lib.rs +++ b/pingora-cache/src/lib.rs @@ -340,7 +340,7 @@ impl HttpCache { /// Enable the cache /// /// - `storage`: the cache storage backend that implements [storage::Storage] - /// - `eviction`: optionally the eviction mananger, without it, nothing will be evicted from the storage + /// - `eviction`: optionally the eviction manager, without it, nothing will be evicted from the storage /// - `predictor`: optionally a cache predictor. The cache predictor predicts whether something is likely /// to be cacheable or not. This is useful because the proxy can apply different types of optimization to /// cacheable and uncacheable requests. diff --git a/pingora-cache/src/memory.rs b/pingora-cache/src/memory.rs index 679517d..525bf23 100644 --- a/pingora-cache/src/memory.rs +++ b/pingora-cache/src/memory.rs @@ -151,7 +151,7 @@ impl PartialHit { }; assert!(bytes_end >= self.bytes_read); - // more data avaliable to read + // more data available to read if bytes_end > self.bytes_read { let new_bytes = Bytes::copy_from_slice(&self.body.read()[self.bytes_read..bytes_end]); diff --git a/pingora-cache/src/meta.rs b/pingora-cache/src/meta.rs index a534dc0..9873ef8 100644 --- a/pingora-cache/src/meta.rs +++ b/pingora-cache/src/meta.rs @@ -316,7 +316,7 @@ pub(crate) struct CacheMetaInner { pub(crate) internal: InternalMeta, pub(crate) header: ResponseHeader, /// An opaque type map to hold extra information for communication between cache backends - /// and users. This field is **not** garanteed be persistently stored in the cache backend. + /// and users. This field is **not** guaranteed be persistently stored in the cache backend. pub extensions: Extensions, } @@ -567,7 +567,7 @@ use pingora_header_serde::HeaderSerde; use std::fs::File; use std::io::Read; -/* load header compression engine and its' dictionary globally */ +/* load header compression engine and its dictionary globally */ pub(crate) static COMPRESSION_DICT_PATH: OnceCell<String> = OnceCell::new(); fn load_file(path: &String) -> Option<Vec<u8>> { diff --git a/pingora-core/src/apps/prometheus_http_app.rs b/pingora-core/src/apps/prometheus_http_app.rs index 146f3da..3508d20 100644 --- a/pingora-core/src/apps/prometheus_http_app.rs +++ b/pingora-core/src/apps/prometheus_http_app.rs @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -//! A HTTP application that reports Prometheus metrics. +//! An HTTP application that reports Prometheus metrics. use async_trait::async_trait; use http::{self, Response}; diff --git a/pingora-core/src/connectors/mod.rs b/pingora-core/src/connectors/mod.rs index ad9fbc4..a5dd99d 100644 --- a/pingora-core/src/connectors/mod.rs +++ b/pingora-core/src/connectors/mod.rs @@ -263,7 +263,7 @@ impl TransportConnector { } // Perform the actual L4 and tls connection steps while respecting the peer's -// connection timeout if there one +// connection timeout if there is one async fn do_connect<P: Peer + Send + Sync>( peer: &P, bind_to: Option<SocketAddr>, diff --git a/pingora-core/src/connectors/tls.rs b/pingora-core/src/connectors/tls.rs index e8eb37e..1950d8f 100644 --- a/pingora-core/src/connectors/tls.rs +++ b/pingora-core/src/connectors/tls.rs @@ -217,7 +217,7 @@ where if peer.sni().is_empty() { ssl_conf.set_use_server_name_indication(false); /* NOTE: technically we can still verify who signs the cert but turn it off to be - consistant with nginx's behavior */ + consistent with nginx's behavior */ ssl_conf.set_verify(SslVerifyMode::NONE); } else if peer.verify_cert() { if peer.verify_hostname() { diff --git a/pingora-core/src/listeners/mod.rs b/pingora-core/src/listeners/mod.rs index 9d08f14..cc8edb8 100644 --- a/pingora-core/src/listeners/mod.rs +++ b/pingora-core/src/listeners/mod.rs @@ -115,7 +115,7 @@ impl Listeners { listeners } - /// Create a new [`Listeners`] with with a TLS (TCP) endpoint with the given address string, + /// Create a new [`Listeners`] with a TLS (TCP) endpoint with the given address string, /// and path to the certificate/private key pairs. /// This endpoint will adopt the [Mozilla Intermediate](https://wiki.mozilla.org/Security/Server_Side_TLS#Intermediate_compatibility_.28recommended.29) /// server side TLS settings. diff --git a/pingora-core/src/listeners/tls.rs b/pingora-core/src/listeners/tls.rs index ec53551..5152582 100644 --- a/pingora-core/src/listeners/tls.rs +++ b/pingora-core/src/listeners/tls.rs @@ -53,7 +53,7 @@ impl DerefMut for TlsSettings { } impl TlsSettings { - /// Create a new [`TlsSettings`] with the the [Mozilla Intermediate](https://wiki.mozilla.org/Security/Server_Side_TLS#Intermediate_compatibility_.28recommended.29). + /// Create a new [`TlsSettings`] with the [Mozilla Intermediate](https://wiki.mozilla.org/Security/Server_Side_TLS#Intermediate_compatibility_.28recommended.29). /// server side TLS settings. Users can adjust the TLS settings after this object is created. /// Return error if the provided certificate and private key are invalid or not found. pub fn intermediate(cert_path: &str, key_path: &str) -> Result<Self> { diff --git a/pingora-core/src/modules/http/mod.rs b/pingora-core/src/modules/http/mod.rs index 9c446b1..0f0401b 100644 --- a/pingora-core/src/modules/http/mod.rs +++ b/pingora-core/src/modules/http/mod.rs @@ -30,7 +30,7 @@ use std::any::TypeId; use std::collections::HashMap; use std::sync::Arc; -/// The trait a HTTP traffic module needs to implement +/// The trait an HTTP traffic module needs to implement // TODO: * async filters for, e.g., 3rd party auth server; * access the connection for, e.g., GeoIP pub trait HttpModule { fn request_header_filter(&mut self, _req: &mut RequestHeader) -> Result<()> { @@ -86,7 +86,7 @@ impl HttpModules { /// /// Each type of [HttpModule] can be only added once. /// # Panic - /// Panic if any [HttpModule] is added more tha once. + /// Panic if any [HttpModule] is added more than once. pub fn add_module(&mut self, builder: ModuleBuilder) { if self.module_index.get().is_some() { // We use a shared module_index the index would be out of sync if we @@ -135,7 +135,7 @@ pub struct HttpModuleCtx { } impl HttpModuleCtx { - /// Create an placeholder empty [HttpModuleCtx]. + /// Create a placeholder empty [HttpModuleCtx]. /// /// [HttpModules] should be used to create nonempty [HttpModuleCtx]. pub fn empty() -> Self { @@ -145,7 +145,7 @@ impl HttpModuleCtx { } } - /// Get a ref to [HttpModule] if any. + /// Get a ref to [HttpModule] if any. pub fn get<T: 'static>(&self) -> Option<&T> { let idx = self.module_index.get(&TypeId::of::<T>())?; let ctx = &self.module_ctx[*idx]; @@ -156,7 +156,7 @@ impl HttpModuleCtx { ) } - /// Get a mut ref to [HttpModule] if any. + /// Get a mut ref to [HttpModule] if any. pub fn get_mut<T: 'static>(&mut self) -> Option<&mut T> { let idx = self.module_index.get(&TypeId::of::<T>())?; let ctx = &mut self.module_ctx[*idx]; diff --git a/pingora-core/src/protocols/http/compression/mod.rs b/pingora-core/src/protocols/http/compression/mod.rs index a16c774..1a5cef2 100644 --- a/pingora-core/src/protocols/http/compression/mod.rs +++ b/pingora-core/src/protocols/http/compression/mod.rs @@ -257,7 +257,7 @@ enum Algorithm { Zstd, // TODO: Identify, // TODO: Deflate - Other, // anyting unknown + Other, // anything unknown } impl Algorithm { @@ -322,7 +322,7 @@ enum Action { Decompress(Algorithm), } -// parse Accpet-Encoding header and put it to the list +// parse Accept-Encoding header and put it to the list fn parse_accept_encoding(accept_encoding: Option<&http::HeaderValue>, list: &mut Vec<Algorithm>) { // https://www.rfc-editor.org/rfc/rfc9110#name-accept-encoding if let Some(ac) = accept_encoding { @@ -339,7 +339,7 @@ fn parse_accept_encoding(accept_encoding: Option<&http::HeaderValue>, list: &mut if let Some(s) = i.bare_item.as_token() { // TODO: support q value let algorithm = Algorithm::from(s); - // ignore algorithms that we don't understand ingore + // ignore algorithms that we don't understand ignore if algorithm != Algorithm::Other { list.push(Algorithm::from(s)); } @@ -400,7 +400,7 @@ fn decide_action(resp: &ResponseHeader, accept_encoding: &[Algorithm]) -> Action Some(Algorithm::Other) } } else { - // no Accpet-encoding + // no Accept-encoding None }; @@ -582,7 +582,7 @@ fn test_adjust_response_header() { header.headers.get("content-length").unwrap().as_bytes(), b"20" ); - assert!(header.headers.get("transfor-encoding").is_none()); + assert!(header.headers.get("transfer-encoding").is_none()); // decompress gzip let mut header = ResponseHeader::build(200, None).unwrap(); diff --git a/pingora-core/src/protocols/http/server.rs b/pingora-core/src/protocols/http/server.rs index 1f84997..c4a0b07 100644 --- a/pingora-core/src/protocols/http/server.rs +++ b/pingora-core/src/protocols/http/server.rs @@ -231,7 +231,7 @@ impl Session { /// Send error response to client pub async fn respond_error(&mut self, error: u16) { let resp = match error { - /* commmon error responses are pre-generated */ + /* common error responses are pre-generated */ 502 => error_resp::HTTP_502_RESPONSE.clone(), 400 => error_resp::HTTP_400_RESPONSE.clone(), _ => error_resp::gen_error_response(error), diff --git a/pingora-core/src/protocols/http/v1/body.rs b/pingora-core/src/protocols/http/v1/body.rs index 81c8b22..8968f9e 100644 --- a/pingora-core/src/protocols/http/v1/body.rs +++ b/pingora-core/src/protocols/http/v1/body.rs @@ -312,7 +312,7 @@ impl BodyReader { } else { if expecting_from_io > 0 { trace!( - "parital chunk playload, expecting_from_io: {}, \ + "partial chunk payload, expecting_from_io: {}, \ existing_buf_end {}, buf: {:?}", expecting_from_io, existing_buf_end, diff --git a/pingora-core/src/protocols/l4/ext.rs b/pingora-core/src/protocols/l4/ext.rs index 331a852..a30e26a 100644 --- a/pingora-core/src/protocols/l4/ext.rs +++ b/pingora-core/src/protocols/l4/ext.rs @@ -212,7 +212,7 @@ pub fn get_tcp_info(_fd: RawFd) -> io::Result<TCP_INFO> { } /* - * this extention is needed until the following are addressed + * this extension is needed until the following are addressed * https://github.com/tokio-rs/tokio/issues/1543 * https://github.com/tokio-rs/mio/issues/1257 * https://github.com/tokio-rs/mio/issues/1211 diff --git a/pingora-core/src/server/configuration/mod.rs b/pingora-core/src/server/configuration/mod.rs index 19db553..0fdbff9 100644 --- a/pingora-core/src/server/configuration/mod.rs +++ b/pingora-core/src/server/configuration/mod.rs @@ -90,13 +90,13 @@ impl Default for ServerConf { } } -/// Commandline options +/// Command-line options /// /// Call `Opt::from_args()` to build this object from the process's command line arguments. #[derive(StructOpt, Debug)] #[structopt(name = "basic")] pub struct Opt { - /// Whether this server should try to upgrade from an running old server + /// Whether this server should try to upgrade from a running old server /// /// `-u` or `--upgrade` can be used #[structopt(short, long)] diff --git a/pingora-core/src/services/listening.rs b/pingora-core/src/services/listening.rs index 6960034..58d7d5b 100644 --- a/pingora-core/src/services/listening.rs +++ b/pingora-core/src/services/listening.rs @@ -79,7 +79,7 @@ impl<A> Service<A> { self.listeners.add_tcp_with_settings(addr, sock_opt); } - /// Add an Unix domain socket listening endpoint with the given path. + /// Add a Unix domain socket listening endpoint with the given path. /// /// Optionally take a permission of the socket file. The default is read and write access for /// everyone (0o666). diff --git a/pingora-core/src/upstreams/peer.rs b/pingora-core/src/upstreams/peer.rs index a36418b..1ee78a7 100644 --- a/pingora-core/src/upstreams/peer.rs +++ b/pingora-core/src/upstreams/peer.rs @@ -119,7 +119,7 @@ pub trait Peer: Display + Clone { None => None, } } - /// How long the overall connection establishment should take before a timeout error is returned. + /// How long the overall connection establishment should take before a timeout error is returned. fn total_connection_timeout(&self) -> Option<Duration> { match self.get_peer_options() { Some(opt) => opt.total_connection_timeout, diff --git a/pingora-core/tests/nginx_proxy.conf b/pingora-core/tests/nginx_proxy.conf index 0acbd93..4e53933 100644 --- a/pingora-core/tests/nginx_proxy.conf +++ b/pingora-core/tests/nginx_proxy.conf @@ -32,7 +32,7 @@ http { keepalive_timeout 30; keepalive_requests 99999; - upstream plantext { + upstream plaintext { server 127.0.0.1:8000; keepalive 128; keepalive_requests 99999; @@ -53,7 +53,7 @@ http { location / { keepalive_timeout 30; - proxy_pass http://plantext; + proxy_pass http://plaintext; proxy_http_version 1.1; proxy_set_header Connection "Keep-Alive"; } diff --git a/pingora-error/src/lib.rs b/pingora-error/src/lib.rs index 6bd6702..91b0358 100644 --- a/pingora-error/src/lib.rs +++ b/pingora-error/src/lib.rs @@ -108,7 +108,7 @@ pub enum ErrorType { TLSHandshakeFailure, TLSHandshakeTimedout, InvalidCert, - HandshakeError, // other handhshake + HandshakeError, // other handshake ConnectError, // catch all BindError, AcceptError, diff --git a/pingora-http/src/case_header_name.rs b/pingora-http/src/case_header_name.rs index 4b6c133..add0ced 100644 --- a/pingora-http/src/case_header_name.rs +++ b/pingora-http/src/case_header_name.rs @@ -35,7 +35,7 @@ impl CaseHeaderName { } } -/// A trait that converts into case sensitive header names. +/// A trait that converts into case-sensitive header names. pub trait IntoCaseHeaderName { fn into_case_header_name(self) -> CaseHeaderName; } diff --git a/pingora-load-balancing/src/health_check.rs b/pingora-load-balancing/src/health_check.rs index adb0c4f..d40221d 100644 --- a/pingora-load-balancing/src/health_check.rs +++ b/pingora-load-balancing/src/health_check.rs @@ -52,7 +52,7 @@ pub struct TcpHealthCheck { /// The SocketAddr of `peer_template` is just a placeholder which will be replaced by the /// actual address of the backend when the health check runs. /// - /// By default this check will try to establish a TCP connection. When the the `sni` field is + /// By default this check will try to establish a TCP connection. When the `sni` field is /// set, it will also try to establish a TLS connection on top of the TCP connection. pub peer_template: BasicPeer, connector: TransportConnector, diff --git a/pingora-lru/src/linked_list.rs b/pingora-lru/src/linked_list.rs index 7664aaf..7a29010 100644 --- a/pingora-lru/src/linked_list.rs +++ b/pingora-lru/src/linked_list.rs @@ -74,7 +74,7 @@ impl Nodes { }; // Constrain the growth of vec: vec always double its capacity when it needs to grow // It could waste too much memory when it is already very large. - // Here we limit the memory waste to 10% onces it grows beyond the cap. + // Here we limit the memory waste to 10% once it grows beyond the cap. // The amortized growth cost is O(n) beyond the max of the initial reserved capacity and // the cap. But this list is for limited sized LRU and we recycle released node, so // hopefully insertions are rare beyond certain sizes diff --git a/pingora-proxy/src/lib.rs b/pingora-proxy/src/lib.rs index d1aa399..9ecac87 100644 --- a/pingora-proxy/src/lib.rs +++ b/pingora-proxy/src/lib.rs @@ -594,7 +594,7 @@ where }; if *shutdown.borrow() { - // stop downstream downstream from reusing if this service is shutting down soon + // stop downstream from reusing if this service is shutting down soon session.set_keepalive(None); } else { // default 60s diff --git a/pingora-proxy/src/proxy_cache.rs b/pingora-proxy/src/proxy_cache.rs index 0dba682..4546b58 100644 --- a/pingora-proxy/src/proxy_cache.rs +++ b/pingora-proxy/src/proxy_cache.rs @@ -220,7 +220,7 @@ impl<SV> HttpProxy<SV> { } Err(e) => { // Allow cache miss to fill cache even if cache lookup errors - // this is mostly to suppport backward incompatible metadata update + // this is mostly to support backward incompatible metadata update // TODO: check error types // session.cache.disable(); self.inner.cache_miss(session, ctx); @@ -280,7 +280,7 @@ impl<SV> HttpProxy<SV> { Err(e) => { // TODO: more logging and error handling session.as_mut().respond_error(500).await; - // we have not write anything dirty to downstream, it is still reuseable + // we have not write anything dirty to downstream, it is still reusable return (true, Some(e)); } } @@ -724,7 +724,7 @@ pub(crate) mod range_filter { use http::header::*; use std::ops::Range; - // parse bytes into usize, ignores specifc error + // parse bytes into usize, ignores specific error fn parse_number(input: &[u8]) -> Option<usize> { str::from_utf8(input).ok()?.parse().ok() } @@ -734,7 +734,7 @@ pub(crate) mod range_filter { // single byte range only for now // https://datatracker.ietf.org/doc/html/rfc7233#section-2.1 - // https://datatracker.ietf.org/doc/html/rfc7233#appendix-C: case insensitive + // https://datatracker.ietf.org/doc/html/rfc7233#appendix-C: case-insensitive static RE_SINGLE_RANGE: Lazy<Regex> = Lazy::new(|| Regex::new(r"(?i)bytes=(?P<start>\d*)-(?P<end>\d*)").unwrap()); diff --git a/pingora-proxy/tests/utils/conf/origin/conf/nginx.conf b/pingora-proxy/tests/utils/conf/origin/conf/nginx.conf index b0ab281..6e55d30 100644 --- a/pingora-proxy/tests/utils/conf/origin/conf/nginx.conf +++ b/pingora-proxy/tests/utils/conf/origin/conf/nginx.conf @@ -253,7 +253,7 @@ http { return 200; } - # 1. A origin load balancer that rejects reused connetions. + # 1. A origin load balancer that rejects reused connections. # this is to simulate the common problem when customers LB drops # connection silently after being keepalived for awhile # 2. A middlebox might drop the connection if the origin takes too long @@ -283,7 +283,7 @@ http { ngx.print(string.rep("A", 64)) ngx.print(string.rep("A", 64)) ngx.print(string.rep("A", 64)) - -- without ngx.req.read_body(), the body will return wihtout waiting for req body + -- without ngx.req.read_body(), the body will return without waiting for req body } } diff --git a/pingora-proxy/tests/utils/server_utils.rs b/pingora-proxy/tests/utils/server_utils.rs index e3aafe7..32f3275 100644 --- a/pingora-proxy/tests/utils/server_utils.rs +++ b/pingora-proxy/tests/utils/server_utils.rs @@ -412,7 +412,7 @@ impl Server { } } -// FIXME: this still allows multiple servers to spawn across intergration tests +// FIXME: this still allows multiple servers to spawn across integration tests pub static TEST_SERVER: Lazy<Server> = Lazy::new(Server::start); use super::mock_origin::MOCK_ORIGIN; diff --git a/pingora-timeout/src/fast_timeout.rs b/pingora-timeout/src/fast_timeout.rs index 5fa7a3d..e5e3643 100644 --- a/pingora-timeout/src/fast_timeout.rs +++ b/pingora-timeout/src/fast_timeout.rs @@ -20,7 +20,7 @@ //! - Timeout timers are rounded to the next 10ms tick and timers are shared across all timeouts with the same deadline. //! //! In order for this to work, a standalone thread is created to arm the timers, which has its -//! overheads. As a general rule, the benefits of this doesn't outweight the overhead unless +//! overheads. As a general rule, the benefits of this doesn't outweigh the overhead unless //! there are more than about 100/s timeout() calls in the system. Use regular tokio timeout or //! [super::tokio_timeout] in the low usage case. diff --git a/pingora/src/lib.rs b/pingora/src/lib.rs index c714ca6..9362818 100644 --- a/pingora/src/lib.rs +++ b/pingora/src/lib.rs @@ -66,7 +66,7 @@ pub mod lb { #[cfg(feature = "proxy")] #[cfg_attr(docsrs, doc(cfg(feature = "proxy")))] -/// Load balancing recipes +/// Proxying recipes pub mod proxy { pub use pingora_proxy::*; } |