1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-07-03 20:45:46 +00:00

Merge pull request #1463 from actix/fix/doc-typos

fix spelling errors in doc comments
This commit is contained in:
Yuki Okushi 2020-04-21 13:47:03 +09:00 committed by GitHub
commit 751253f23e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 44 additions and 44 deletions

View file

@ -521,7 +521,7 @@ impl Service for FilesService {
Err(e) => return Either::Left(ok(req.error_response(e))), Err(e) => return Either::Left(ok(req.error_response(e))),
}; };
// full filepath // full file path
let path = match self.directory.join(&real_path.0).canonicalize() { let path = match self.directory.join(&real_path.0).canonicalize() {
Ok(path) => path, Ok(path) => path,
Err(e) => return self.handle_err(e, req), Err(e) => return self.handle_err(e, req),

View file

@ -7,7 +7,7 @@ mod service;
mod state; mod state;
pub mod test; pub mod test;
// re-export for convinience // re-export for convenience
pub use actix_http::{http, Error, HttpMessage, Response, ResponseError}; pub use actix_http::{http, Error, HttpMessage, Response, ResponseError};
pub use self::app::{FramedApp, FramedAppService}; pub use self::app::{FramedApp, FramedAppService};

View file

@ -42,7 +42,7 @@ impl<Io, S> FramedRequest<Io, S> {
self.req.head() self.req.head()
} }
/// This method returns muttable reference to the request head. /// This method returns mutable reference to the request head.
/// panics if multiple references of http request exists. /// panics if multiple references of http request exists.
#[inline] #[inline]
pub fn head_mut(&mut self) -> &mut RequestHead { pub fn head_mut(&mut self) -> &mut RequestHead {
@ -131,7 +131,7 @@ mod tests {
use super::*; use super::*;
#[test] #[test]
fn test_reqest() { fn test_request() {
let buf = TestBuffer::empty(); let buf = TestBuffer::empty();
let framed = Framed::new(buf, Codec::default()); let framed = Framed::new(buf, Codec::default());
let req = TestRequest::with_uri("/index.html?q=1") let req = TestRequest::with_uri("/index.html?q=1")

View file

@ -114,7 +114,7 @@ impl ServiceConfig {
} }
#[inline] #[inline]
/// Return state of connection keep-alive funcitonality /// Return state of connection keep-alive functionality
pub fn keep_alive_enabled(&self) -> bool { pub fn keep_alive_enabled(&self) -> bool {
self.0.ka_enabled self.0.ka_enabled
} }

View file

@ -13,7 +13,7 @@ use super::secure::{Key, PrivateJar, SignedJar};
/// ///
/// A `CookieJar` provides storage for any number of cookies. Any changes made /// A `CookieJar` provides storage for any number of cookies. Any changes made
/// to the jar are tracked; the changes can be retrieved via the /// to the jar are tracked; the changes can be retrieved via the
/// [delta](#method.delta) method which returns an interator over the changes. /// [delta](#method.delta) method which returns an iterator over the changes.
/// ///
/// # Usage /// # Usage
/// ///

View file

@ -103,7 +103,7 @@ enum CookieStr {
impl CookieStr { impl CookieStr {
/// Retrieves the string `self` corresponds to. If `self` is derived from /// Retrieves the string `self` corresponds to. If `self` is derived from
/// indexes, the corresponding subslice of `string` is returned. Otherwise, /// indexes, the corresponding sub-slice of `string` is returned. Otherwise,
/// the concrete string is returned. /// the concrete string is returned.
/// ///
/// # Panics /// # Panics

View file

@ -84,7 +84,7 @@ impl Key {
} }
/// Generates signing/encryption keys from a secure, random source. Keys are /// Generates signing/encryption keys from a secure, random source. Keys are
/// generated nondeterministically. /// generated non-deterministically.
/// ///
/// # Panics /// # Panics
/// ///
@ -103,7 +103,7 @@ impl Key {
} }
/// Attempts to generate signing/encryption keys from a secure, random /// Attempts to generate signing/encryption keys from a secure, random
/// source. Keys are generated nondeterministically. If randomness cannot be /// source. Keys are generated non-deterministically. If randomness cannot be
/// retrieved from the underlying operating system, returns `None`. /// retrieved from the underlying operating system, returns `None`.
/// ///
/// # Example /// # Example

View file

@ -18,7 +18,7 @@ use serde::de::value::Error as DeError;
use serde_json::error::Error as JsonError; use serde_json::error::Error as JsonError;
use serde_urlencoded::ser::Error as FormError; use serde_urlencoded::ser::Error as FormError;
// re-export for convinience // re-export for convenience
use crate::body::Body; use crate::body::Body;
pub use crate::cookie::ParseError as CookieParseError; pub use crate::cookie::ParseError as CookieParseError;
use crate::helpers::Writer; use crate::helpers::Writer;
@ -432,7 +432,7 @@ pub enum DispatchError {
Unknown, Unknown,
} }
/// A set of error that can occure during parsing content type /// A set of error that can occur during parsing content type
#[derive(PartialEq, Debug, Display)] #[derive(PartialEq, Debug, Display)]
pub enum ContentTypeError { pub enum ContentTypeError {
/// Can not parse content type /// Can not parse content type

View file

@ -18,7 +18,7 @@ use crate::request::Request;
const MAX_BUFFER_SIZE: usize = 131_072; const MAX_BUFFER_SIZE: usize = 131_072;
const MAX_HEADERS: usize = 96; const MAX_HEADERS: usize = 96;
/// Incoming messagd decoder /// Incoming message decoder
pub(crate) struct MessageDecoder<T: MessageType>(PhantomData<T>); pub(crate) struct MessageDecoder<T: MessageType>(PhantomData<T>);
#[derive(Debug)] #[derive(Debug)]

View file

@ -297,8 +297,8 @@ where
/// Flush stream /// Flush stream
/// ///
/// true - got whouldblock /// true - got WouldBlock
/// false - didnt get whouldblock /// false - didn't get WouldBlock
#[pin_project::project] #[pin_project::project]
fn poll_flush( fn poll_flush(
self: Pin<&mut Self>, self: Pin<&mut Self>,
@ -812,7 +812,7 @@ where
return self.poll(cx); return self.poll(cx);
} }
// we didnt get WouldBlock from write operation, // we didn't get WouldBlock from write operation,
// so data get written to kernel completely (OSX) // so data get written to kernel completely (OSX)
// and we have to write again otherwise response can get stuck // and we have to write again otherwise response can get stuck
if inner.as_mut().poll_flush(cx)? || !drain { if inner.as_mut().poll_flush(cx)? || !drain {

View file

@ -90,40 +90,40 @@ pub enum DispositionParam {
/// [RFC6266](https://tools.ietf.org/html/rfc6266) as *token "=" value*. Recipients should /// [RFC6266](https://tools.ietf.org/html/rfc6266) as *token "=" value*. Recipients should
/// ignore unrecognizable parameters. /// ignore unrecognizable parameters.
Unknown(String, String), Unknown(String, String),
/// An unrecognized extended paramater as defined in /// An unrecognized extended parameter as defined in
/// [RFC5987](https://tools.ietf.org/html/rfc5987) as *ext-parameter*, in /// [RFC5987](https://tools.ietf.org/html/rfc5987) as *ext-parameter*, in
/// [RFC6266](https://tools.ietf.org/html/rfc6266) as *ext-token "=" ext-value*. The single /// [RFC6266](https://tools.ietf.org/html/rfc6266) as *ext-token "=" ext-value*. The single
/// trailling asterisk is not included. Recipients should ignore unrecognizable parameters. /// trailing asterisk is not included. Recipients should ignore unrecognizable parameters.
UnknownExt(String, ExtendedValue), UnknownExt(String, ExtendedValue),
} }
impl DispositionParam { impl DispositionParam {
/// Returns `true` if the paramater is [`Name`](DispositionParam::Name). /// Returns `true` if the parameter is [`Name`](DispositionParam::Name).
#[inline] #[inline]
pub fn is_name(&self) -> bool { pub fn is_name(&self) -> bool {
self.as_name().is_some() self.as_name().is_some()
} }
/// Returns `true` if the paramater is [`Filename`](DispositionParam::Filename). /// Returns `true` if the parameter is [`Filename`](DispositionParam::Filename).
#[inline] #[inline]
pub fn is_filename(&self) -> bool { pub fn is_filename(&self) -> bool {
self.as_filename().is_some() self.as_filename().is_some()
} }
/// Returns `true` if the paramater is [`FilenameExt`](DispositionParam::FilenameExt). /// Returns `true` if the parameter is [`FilenameExt`](DispositionParam::FilenameExt).
#[inline] #[inline]
pub fn is_filename_ext(&self) -> bool { pub fn is_filename_ext(&self) -> bool {
self.as_filename_ext().is_some() self.as_filename_ext().is_some()
} }
/// Returns `true` if the paramater is [`Unknown`](DispositionParam::Unknown) and the `name` /// Returns `true` if the parameter is [`Unknown`](DispositionParam::Unknown) and the `name`
#[inline] #[inline]
/// matches. /// matches.
pub fn is_unknown<T: AsRef<str>>(&self, name: T) -> bool { pub fn is_unknown<T: AsRef<str>>(&self, name: T) -> bool {
self.as_unknown(name).is_some() self.as_unknown(name).is_some()
} }
/// Returns `true` if the paramater is [`UnknownExt`](DispositionParam::UnknownExt) and the /// Returns `true` if the parameter is [`UnknownExt`](DispositionParam::UnknownExt) and the
/// `name` matches. /// `name` matches.
#[inline] #[inline]
pub fn is_unknown_ext<T: AsRef<str>>(&self, name: T) -> bool { pub fn is_unknown_ext<T: AsRef<str>>(&self, name: T) -> bool {
@ -373,7 +373,7 @@ impl ContentDisposition {
let param = if param_name.eq_ignore_ascii_case("name") { let param = if param_name.eq_ignore_ascii_case("name") {
DispositionParam::Name(value) DispositionParam::Name(value)
} else if param_name.eq_ignore_ascii_case("filename") { } else if param_name.eq_ignore_ascii_case("filename") {
// See also comments in test_from_raw_uncessary_percent_decode. // See also comments in test_from_raw_unnecessary_percent_decode.
DispositionParam::Filename(value) DispositionParam::Filename(value)
} else { } else {
DispositionParam::Unknown(param_name.to_owned(), value) DispositionParam::Unknown(param_name.to_owned(), value)
@ -529,7 +529,7 @@ impl fmt::Display for DispositionParam {
// ; to use within parameter values // ; to use within parameter values
// //
// //
// See also comments in test_from_raw_uncessary_percent_decode. // See also comments in test_from_raw_unnecessary_percent_decode.
lazy_static! { lazy_static! {
static ref RE: Regex = Regex::new("[\x00-\x08\x10-\x1F\x7F\"\\\\]").unwrap(); static ref RE: Regex = Regex::new("[\x00-\x08\x10-\x1F\x7F\"\\\\]").unwrap();
} }
@ -676,7 +676,7 @@ mod tests {
fn test_from_raw_unordered() { fn test_from_raw_unordered() {
let a = HeaderValue::from_static( let a = HeaderValue::from_static(
"form-data; dummy=3; filename=\"sample.png\" ; name=upload;", "form-data; dummy=3; filename=\"sample.png\" ; name=upload;",
// Actually, a trailling semolocon is not compliant. But it is fine to accept. // Actually, a trailing semicolon is not compliant. But it is fine to accept.
); );
let a: ContentDisposition = ContentDisposition::from_raw(&a).unwrap(); let a: ContentDisposition = ContentDisposition::from_raw(&a).unwrap();
let b = ContentDisposition { let b = ContentDisposition {
@ -833,7 +833,7 @@ mod tests {
} }
#[test] #[test]
fn test_from_raw_uncessary_percent_decode() { fn test_from_raw_unnecessary_percent_decode() {
// In fact, RFC7578 (multipart/form-data) Section 2 and 4.2 suggests that filename with // In fact, RFC7578 (multipart/form-data) Section 2 and 4.2 suggests that filename with
// non-ASCII characters MAY be percent-encoded. // non-ASCII characters MAY be percent-encoded.
// On the contrary, RFC6266 or other RFCs related to Content-Disposition response header // On the contrary, RFC6266 or other RFCs related to Content-Disposition response header

View file

@ -7,7 +7,7 @@ use header::{Header, Raw};
/// `Range` header, defined in [RFC7233](https://tools.ietf.org/html/rfc7233#section-3.1) /// `Range` header, defined in [RFC7233](https://tools.ietf.org/html/rfc7233#section-3.1)
/// ///
/// The "Range" header field on a GET request modifies the method /// The "Range" header field on a GET request modifies the method
/// semantics to request transfer of only one or more subranges of the /// semantics to request transfer of only one or more sub-ranges of the
/// selected representation data, rather than the entire selected /// selected representation data, rather than the entire selected
/// representation data. /// representation data.
/// ///

View file

@ -7,7 +7,7 @@ use http::header::{HeaderName, HeaderValue};
/// A set of HTTP headers /// A set of HTTP headers
/// ///
/// `HeaderMap` is an multimap of [`HeaderName`] to values. /// `HeaderMap` is an multi-map of [`HeaderName`] to values.
/// ///
/// [`HeaderName`]: struct.HeaderName.html /// [`HeaderName`]: struct.HeaderName.html
#[derive(Debug, Clone)] #[derive(Debug, Clone)]

View file

@ -99,13 +99,13 @@ impl RequestHead {
} }
/// Is to uppercase headers with Camel-Case. /// Is to uppercase headers with Camel-Case.
/// Befault is `false` /// Default is `false`
#[inline] #[inline]
pub fn camel_case_headers(&self) -> bool { pub fn camel_case_headers(&self) -> bool {
self.flags.contains(Flags::CAMEL_CASE) self.flags.contains(Flags::CAMEL_CASE)
} }
/// Set `true` to send headers which are uppercased with Camel-Case. /// Set `true` to send headers which are formatted as Camel-Case.
#[inline] #[inline]
pub fn set_camel_case_headers(&mut self, val: bool) { pub fn set_camel_case_headers(&mut self, val: bool) {
if val { if val {

View file

@ -110,7 +110,7 @@ impl ResponseError for HandshakeError {
} }
} }
/// Verify `WebSocket` handshake request and create handshake reponse. /// Verify `WebSocket` handshake request and create handshake response.
// /// `protocols` is a sequence of known protocols. On successful handshake, // /// `protocols` is a sequence of known protocols. On successful handshake,
// /// the returned response headers contain the first protocol in this list // /// the returned response headers contain the first protocol in this list
// /// which the server also knows. // /// which the server also knows.
@ -170,7 +170,7 @@ pub fn verify_handshake(req: &RequestHead) -> Result<(), HandshakeError> {
Ok(()) Ok(())
} }
/// Create websocket's handshake response /// Create websocket handshake response
/// ///
/// This function returns handshake `Response`, ready to send to peer. /// This function returns handshake `Response`, ready to send to peer.
pub fn handshake_response(req: &RequestHead) -> ResponseBuilder { pub fn handshake_response(req: &RequestHead) -> ResponseBuilder {

View file

@ -203,7 +203,7 @@ impl<T: Into<String>> From<(CloseCode, T)> for CloseReason {
static WS_GUID: &str = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"; static WS_GUID: &str = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
// TODO: hash is always same size, we dont need String // TODO: hash is always same size, we don't need String
pub fn hash_key(key: &[u8]) -> String { pub fn hash_key(key: &[u8]) -> String {
use sha1::Digest; use sha1::Digest;
let mut hasher = sha1::Sha1::new(); let mut hasher = sha1::Sha1::new();

View file

@ -320,7 +320,7 @@ where
/// Registers middleware, in the form of a middleware component (type), /// Registers middleware, in the form of a middleware component (type),
/// that runs during inbound and/or outbound processing in the request /// that runs during inbound and/or outbound processing in the request
/// lifecycle (request -> response), modifying request/response as /// life-cycle (request -> response), modifying request/response as
/// necessary, across all requests managed by the *Application*. /// necessary, across all requests managed by the *Application*.
/// ///
/// Use middleware when you need to read or modify *every* request or /// Use middleware when you need to read or modify *every* request or
@ -385,7 +385,7 @@ where
} }
/// Registers middleware, in the form of a closure, that runs during inbound /// Registers middleware, in the form of a closure, that runs during inbound
/// and/or outbound processing in the request lifecycle (request -> response), /// and/or outbound processing in the request life-cycle (request -> response),
/// modifying request/response as necessary, across all requests managed by /// modifying request/response as necessary, across all requests managed by
/// the *Application*. /// the *Application*.
/// ///

View file

@ -50,7 +50,7 @@ impl AppService {
} }
} }
/// Check if root is beeing configured /// Check if root is being configured
pub fn is_root(&self) -> bool { pub fn is_root(&self) -> bool {
self.root self.root
} }

View file

@ -6,7 +6,7 @@
//! It is possible to add guards to *scopes*, *resources* //! It is possible to add guards to *scopes*, *resources*
//! and *routes*. Actix provide several guards by default, like various //! and *routes*. Actix provide several guards by default, like various
//! http methods, header, etc. To become a guard, type must implement `Guard` //! http methods, header, etc. To become a guard, type must implement `Guard`
//! trait. Simple functions coulds guards as well. //! trait. Simple functions could be guards as well.
//! //!
//! Guards can not modify the request object. But it is possible //! Guards can not modify the request object. But it is possible
//! to store extra attributes on a request by using the `Extensions` container. //! to store extra attributes on a request by using the `Extensions` container.
@ -100,7 +100,7 @@ pub fn Any<F: Guard + 'static>(guard: F) -> AnyGuard {
AnyGuard(vec![Box::new(guard)]) AnyGuard(vec![Box::new(guard)])
} }
/// Matches if any of supplied guards matche. /// Matches any of supplied guards.
pub struct AnyGuard(Vec<Box<dyn Guard>>); pub struct AnyGuard(Vec<Box<dyn Guard>>);
impl AnyGuard { impl AnyGuard {

View file

@ -5,7 +5,7 @@ use actix_service::{Service, Transform};
use futures::future::{ok, Either, FutureExt, LocalBoxFuture}; use futures::future::{ok, Either, FutureExt, LocalBoxFuture};
/// `Middleware` for conditionally enables another middleware. /// `Middleware` for conditionally enables another middleware.
/// The controled middleware must not change the `Service` interfaces. /// The controlled middleware must not change the `Service` interfaces.
/// This means you cannot control such middlewares like `Logger` or `Compress`. /// This means you cannot control such middlewares like `Logger` or `Compress`.
/// ///
/// ## Usage /// ## Usage

View file

@ -57,7 +57,7 @@ impl HttpRequest {
&self.0.head &self.0.head
} }
/// This method returns muttable reference to the request head. /// This method returns mutable reference to the request head.
/// panics if multiple references of http request exists. /// panics if multiple references of http request exists.
#[inline] #[inline]
pub(crate) fn head_mut(&mut self) -> &mut RequestHead { pub(crate) fn head_mut(&mut self) -> &mut RequestHead {

View file

@ -46,7 +46,7 @@ type HttpNewService = BoxServiceFactory<(), ServiceRequest, ServiceResponse, Err
/// ``` /// ```
/// ///
/// If no matching route could be found, *405* response code get returned. /// If no matching route could be found, *405* response code get returned.
/// Default behavior could be overriden with `default_resource()` method. /// Default behavior could be overridden with `default_resource()` method.
pub struct Resource<T = ResourceEndpoint> { pub struct Resource<T = ResourceEndpoint> {
endpoint: T, endpoint: T,
rdef: Vec<String>, rdef: Vec<String>,

View file

@ -303,7 +303,7 @@ where
/// Registers middleware, in the form of a middleware component (type), /// Registers middleware, in the form of a middleware component (type),
/// that runs during inbound processing in the request /// that runs during inbound processing in the request
/// lifecycle (request -> response), modifying request as /// life-cycle (request -> response), modifying request as
/// necessary, across all requests managed by the *Scope*. Scope-level /// necessary, across all requests managed by the *Scope*. Scope-level
/// middleware is more limited in what it can modify, relative to Route or /// middleware is more limited in what it can modify, relative to Route or
/// Application level middleware, in that Scope-level middleware can not modify /// Application level middleware, in that Scope-level middleware can not modify
@ -344,7 +344,7 @@ where
} }
/// Registers middleware, in the form of a closure, that runs during inbound /// Registers middleware, in the form of a closure, that runs during inbound
/// processing in the request lifecycle (request -> response), modifying /// processing in the request life-cycle (request -> response), modifying
/// request as necessary, across all requests managed by the *Scope*. /// request as necessary, across all requests managed by the *Scope*.
/// Scope-level middleware is more limited in what it can modify, relative /// Scope-level middleware is more limited in what it can modify, relative
/// to Route or Application level middleware, in that Scope-level middleware /// to Route or Application level middleware, in that Scope-level middleware

View file

@ -69,7 +69,7 @@ impl ServiceRequest {
/// Construct request from parts. /// Construct request from parts.
/// ///
/// `ServiceRequest` can be re-constructed only if `req` hasnt been cloned. /// `ServiceRequest` can be re-constructed only if `req` hasn't been cloned.
pub fn from_parts( pub fn from_parts(
mut req: HttpRequest, mut req: HttpRequest,
pl: Payload, pl: Payload,