mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-28 09:42:40 +01:00
spelling check
This commit is contained in:
parent
a7c24aace1
commit
e1d9c3803b
@ -136,7 +136,7 @@ impl<S> Application<S> where S: 'static {
|
|||||||
/// Create application with specific state. Application can be
|
/// Create application with specific state. Application can be
|
||||||
/// configured with builder-like pattern.
|
/// configured with builder-like pattern.
|
||||||
///
|
///
|
||||||
/// State is shared with all reousrces within same application and could be
|
/// State is shared with all resources within same application and could be
|
||||||
/// accessed with `HttpRequest::state()` method.
|
/// accessed with `HttpRequest::state()` method.
|
||||||
pub fn with_state(state: S) -> Application<S> {
|
pub fn with_state(state: S) -> Application<S> {
|
||||||
Application {
|
Application {
|
||||||
|
@ -31,7 +31,7 @@ pub enum Binary {
|
|||||||
Bytes(Bytes),
|
Bytes(Bytes),
|
||||||
/// Static slice
|
/// Static slice
|
||||||
Slice(&'static [u8]),
|
Slice(&'static [u8]),
|
||||||
/// Shared stirng body
|
/// Shared string body
|
||||||
SharedString(Rc<String>),
|
SharedString(Rc<String>),
|
||||||
/// Shared string body
|
/// Shared string body
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
|
@ -127,7 +127,7 @@ impl<A, S> HttpContext<A, S> where A: Actor<Context=Self> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Indicate end of streamimng payload. Also this method calls `Self::close`.
|
/// Indicate end of streaming payload. Also this method calls `Self::close`.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn write_eof(&mut self) {
|
pub fn write_eof(&mut self) {
|
||||||
self.add_frame(Frame::Chunk(None));
|
self.add_frame(Frame::Chunk(None));
|
||||||
|
@ -320,7 +320,7 @@ pub enum WsHandshakeError {
|
|||||||
/// Only get method is allowed
|
/// Only get method is allowed
|
||||||
#[fail(display="Method not allowed")]
|
#[fail(display="Method not allowed")]
|
||||||
GetMethodRequired,
|
GetMethodRequired,
|
||||||
/// Ugrade header if not set to websocket
|
/// Upgrade header if not set to websocket
|
||||||
#[fail(display="Websocket upgrade is expected")]
|
#[fail(display="Websocket upgrade is expected")]
|
||||||
NoWebsocketUpgrade,
|
NoWebsocketUpgrade,
|
||||||
/// Connection header is not set to upgrade
|
/// Connection header is not set to upgrade
|
||||||
@ -329,7 +329,7 @@ pub enum WsHandshakeError {
|
|||||||
/// Websocket version header is not set
|
/// Websocket version header is not set
|
||||||
#[fail(display="Websocket version header is required")]
|
#[fail(display="Websocket version header is required")]
|
||||||
NoVersionHeader,
|
NoVersionHeader,
|
||||||
/// Unsupported websockt version
|
/// Unsupported websocket version
|
||||||
#[fail(display="Unsupported version")]
|
#[fail(display="Unsupported version")]
|
||||||
UnsupportedVersion,
|
UnsupportedVersion,
|
||||||
/// Websocket key is not set or wrong
|
/// Websocket key is not set or wrong
|
||||||
@ -510,7 +510,7 @@ macro_rules! ERROR_WRAP {
|
|||||||
/// Helper type that can wrap any error and generate *BAD REQUEST* response.
|
/// Helper type that can wrap any error and generate *BAD REQUEST* response.
|
||||||
///
|
///
|
||||||
/// In following example any `io::Error` will be converted into "BAD REQUEST" response
|
/// In following example any `io::Error` will be converted into "BAD REQUEST" response
|
||||||
/// as oposite to *INNTERNAL SERVER ERROR* which is defined by default.
|
/// as opposite to *INNTERNAL SERVER ERROR* which is defined by default.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// # extern crate actix_web;
|
/// # extern crate actix_web;
|
||||||
|
@ -9,7 +9,7 @@ use error::Error;
|
|||||||
use httprequest::HttpRequest;
|
use httprequest::HttpRequest;
|
||||||
use httpresponse::HttpResponse;
|
use httpresponse::HttpResponse;
|
||||||
|
|
||||||
/// Trait defines object that could be regestered as route handler
|
/// Trait defines object that could be registered as route handler
|
||||||
#[allow(unused_variables)]
|
#[allow(unused_variables)]
|
||||||
pub trait Handler<S>: 'static {
|
pub trait Handler<S>: 'static {
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ pub trait Responder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
/// Convinience trait that convert `Future` object into `Boxed` future
|
/// Convenience trait that convert `Future` object into `Boxed` future
|
||||||
pub trait AsyncResponder<I, E>: Sized {
|
pub trait AsyncResponder<I, E>: Sized {
|
||||||
fn responder(self) -> Box<Future<Item=I, Error=E>>;
|
fn responder(self) -> Box<Future<Item=I, Error=E>>;
|
||||||
}
|
}
|
||||||
@ -193,7 +193,7 @@ impl<I, E> Responder for Box<Future<Item=I, Error=E>>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Trait defines object that could be regestered as resource route
|
/// Trait defines object that could be registered as resource route
|
||||||
pub(crate) trait RouteHandler<S>: 'static {
|
pub(crate) trait RouteHandler<S>: 'static {
|
||||||
fn handle(&mut self, req: HttpRequest<S>) -> Reply;
|
fn handle(&mut self, req: HttpRequest<S>) -> Reply;
|
||||||
}
|
}
|
||||||
|
@ -222,7 +222,7 @@ impl<S> HttpRequest<S> {
|
|||||||
self.uri().path()
|
self.uri().path()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get *ConnectionInfo* for currect request.
|
/// Get *ConnectionInfo* for correct request.
|
||||||
pub fn connection_info(&self) -> &ConnectionInfo {
|
pub fn connection_info(&self) -> &ConnectionInfo {
|
||||||
if self.as_ref().info.is_none() {
|
if self.as_ref().info.is_none() {
|
||||||
let info: ConnectionInfo<'static> = unsafe{
|
let info: ConnectionInfo<'static> = unsafe{
|
||||||
@ -278,7 +278,7 @@ impl<S> HttpRequest<S> {
|
|||||||
|
|
||||||
/// Peer socket address
|
/// Peer socket address
|
||||||
///
|
///
|
||||||
/// Peer address is actuall socket address, if proxy is used in front of
|
/// Peer address is actual socket address, if proxy is used in front of
|
||||||
/// actix http server, then peer address would be address of this proxy.
|
/// actix http server, then peer address would be address of this proxy.
|
||||||
///
|
///
|
||||||
/// To get client connection information `connection_info()` method should be used.
|
/// To get client connection information `connection_info()` method should be used.
|
||||||
|
@ -217,7 +217,7 @@ pub struct CookieSession {
|
|||||||
inner: Rc<CookieSessionInner>,
|
inner: Rc<CookieSessionInner>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Errors that can occure during handling cookie session
|
/// Errors that can occur during handling cookie session
|
||||||
#[derive(Fail, Debug)]
|
#[derive(Fail, Debug)]
|
||||||
pub enum CookieSessionError {
|
pub enum CookieSessionError {
|
||||||
/// Size of the serialized session is greater than 4000 bytes.
|
/// Size of the serialized session is greater than 4000 bytes.
|
||||||
|
@ -77,7 +77,7 @@ impl<'a> Params<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return iterator to items in paramter container
|
/// Return iterator to items in parameter container
|
||||||
pub fn iter(&self) -> Iter<(Cow<'a, str>, Cow<'a, str>)> {
|
pub fn iter(&self) -> Iter<(Cow<'a, str>, Cow<'a, str>)> {
|
||||||
self.0.iter()
|
self.0.iter()
|
||||||
}
|
}
|
||||||
|
@ -210,7 +210,7 @@ impl<S: 'static, H: PipelineHandler<S>> StartMiddlewares<S, H> {
|
|||||||
|
|
||||||
fn init(info: &mut PipelineInfo<S>, handler: Rc<RefCell<H>>) -> PipelineState<S, H> {
|
fn init(info: &mut PipelineInfo<S>, handler: Rc<RefCell<H>>) -> PipelineState<S, H> {
|
||||||
// execute middlewares, we need this stage because middlewares could be non-async
|
// execute middlewares, we need this stage because middlewares could be non-async
|
||||||
// and we can move to next state immidietly
|
// and we can move to next state immediately
|
||||||
let len = info.mws.len();
|
let len = info.mws.len();
|
||||||
loop {
|
loop {
|
||||||
if info.count == len {
|
if info.count == len {
|
||||||
|
@ -19,7 +19,7 @@ use httpresponse::HttpResponse;
|
|||||||
/// Route uses builder-like pattern for configuration.
|
/// Route uses builder-like pattern for configuration.
|
||||||
/// During request handling, resource object iterate through all routes
|
/// During request handling, resource object iterate through all routes
|
||||||
/// and check all predicates for specific route, if request matches all predicates route
|
/// and check all predicates for specific route, if request matches all predicates route
|
||||||
/// route considired matched and route handler get called.
|
/// route considered matched and route handler get called.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// # extern crate actix_web;
|
/// # extern crate actix_web;
|
||||||
|
@ -646,7 +646,7 @@ enum TransferEncodingKind {
|
|||||||
Length(u64),
|
Length(u64),
|
||||||
/// An Encoder for when Content-Length is not known.
|
/// An Encoder for when Content-Length is not known.
|
||||||
///
|
///
|
||||||
/// Appliction decides when to stop writing.
|
/// Application decides when to stop writing.
|
||||||
Eof,
|
Eof,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ impl<T, H> Http1<T, H>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: refacrtor
|
// TODO: refactor
|
||||||
#[cfg_attr(feature = "cargo-clippy", allow(cyclomatic_complexity))]
|
#[cfg_attr(feature = "cargo-clippy", allow(cyclomatic_complexity))]
|
||||||
pub fn poll(&mut self) -> Poll<(), ()> {
|
pub fn poll(&mut self) -> Poll<(), ()> {
|
||||||
// keep-alive timer
|
// keep-alive timer
|
||||||
@ -133,7 +133,7 @@ impl<T, H> Http1<T, H>
|
|||||||
Ok(Async::Ready(ready)) => {
|
Ok(Async::Ready(ready)) => {
|
||||||
not_ready = false;
|
not_ready = false;
|
||||||
|
|
||||||
// overide keep-alive state
|
// override keep-alive state
|
||||||
if self.stream.keepalive() {
|
if self.stream.keepalive() {
|
||||||
self.flags.insert(Flags::KEEPALIVE);
|
self.flags.insert(Flags::KEEPALIVE);
|
||||||
} else {
|
} else {
|
||||||
|
@ -268,9 +268,9 @@ impl<H: HttpHandler, U, V> HttpServer<TcpStream, net::SocketAddr, H, U>
|
|||||||
where U: IntoIterator<Item=V> + 'static,
|
where U: IntoIterator<Item=V> + 'static,
|
||||||
V: IntoHttpHandler<Handler=H>,
|
V: IntoHttpHandler<Handler=H>,
|
||||||
{
|
{
|
||||||
/// Start listening for incomming connections.
|
/// Start listening for incoming connections.
|
||||||
///
|
///
|
||||||
/// This method starts number of http handler workers in seperate threads.
|
/// This method starts number of http handler workers in separate threads.
|
||||||
/// For each address this method starts separate thread which does `accept()` in a loop.
|
/// For each address this method starts separate thread which does `accept()` in a loop.
|
||||||
///
|
///
|
||||||
/// This methods panics if no socket addresses get bound.
|
/// This methods panics if no socket addresses get bound.
|
||||||
@ -298,7 +298,7 @@ impl<H: HttpHandler, U, V> HttpServer<TcpStream, net::SocketAddr, H, U>
|
|||||||
pub fn start(mut self) -> SyncAddress<Self>
|
pub fn start(mut self) -> SyncAddress<Self>
|
||||||
{
|
{
|
||||||
if self.sockets.is_empty() {
|
if self.sockets.is_empty() {
|
||||||
panic!("HttpServer::bind() has to be called befor start()");
|
panic!("HttpServer::bind() has to be called before start()");
|
||||||
} else {
|
} else {
|
||||||
let addrs: Vec<(net::SocketAddr, net::TcpListener)> =
|
let addrs: Vec<(net::SocketAddr, net::TcpListener)> =
|
||||||
self.sockets.drain().collect();
|
self.sockets.drain().collect();
|
||||||
@ -320,7 +320,7 @@ impl<H: HttpHandler, U, V> HttpServer<TcpStream, net::SocketAddr, H, U>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Spawn new thread and start listening for incomming connections.
|
/// Spawn new thread and start listening for incoming connections.
|
||||||
///
|
///
|
||||||
/// This method spawns new thread and starts new actix system. Other than that it is
|
/// This method spawns new thread and starts new actix system. Other than that it is
|
||||||
/// similar to `start()` method. This method blocks.
|
/// similar to `start()` method. This method blocks.
|
||||||
@ -359,7 +359,7 @@ impl<H: HttpHandler, U, V> HttpServer<TlsStream<TcpStream>, net::SocketAddr, H,
|
|||||||
where U: IntoIterator<Item=V> + 'static,
|
where U: IntoIterator<Item=V> + 'static,
|
||||||
V: IntoHttpHandler<Handler=H>,
|
V: IntoHttpHandler<Handler=H>,
|
||||||
{
|
{
|
||||||
/// Start listening for incomming tls connections.
|
/// Start listening for incoming tls connections.
|
||||||
pub fn start_tls(mut self, pkcs12: ::Pkcs12) -> io::Result<SyncAddress<Self>> {
|
pub fn start_tls(mut self, pkcs12: ::Pkcs12) -> io::Result<SyncAddress<Self>> {
|
||||||
if self.sockets.is_empty() {
|
if self.sockets.is_empty() {
|
||||||
Err(io::Error::new(io::ErrorKind::Other, "No socket addresses are bound"))
|
Err(io::Error::new(io::ErrorKind::Other, "No socket addresses are bound"))
|
||||||
@ -398,7 +398,7 @@ impl<H: HttpHandler, U, V> HttpServer<SslStream<TcpStream>, net::SocketAddr, H,
|
|||||||
where U: IntoIterator<Item=V> + 'static,
|
where U: IntoIterator<Item=V> + 'static,
|
||||||
V: IntoHttpHandler<Handler=H>,
|
V: IntoHttpHandler<Handler=H>,
|
||||||
{
|
{
|
||||||
/// Start listening for incomming tls connections.
|
/// Start listening for incoming tls connections.
|
||||||
///
|
///
|
||||||
/// This method sets alpn protocols to "h2" and "http/1.1"
|
/// This method sets alpn protocols to "h2" and "http/1.1"
|
||||||
pub fn start_ssl(mut self, identity: &ParsedPkcs12) -> io::Result<SyncAddress<Self>> {
|
pub fn start_ssl(mut self, identity: &ParsedPkcs12) -> io::Result<SyncAddress<Self>> {
|
||||||
@ -443,7 +443,7 @@ impl<T, A, H, U, V> HttpServer<WrapperStream<T>, A, H, U>
|
|||||||
U: IntoIterator<Item=V> + 'static,
|
U: IntoIterator<Item=V> + 'static,
|
||||||
V: IntoHttpHandler<Handler=H>,
|
V: IntoHttpHandler<Handler=H>,
|
||||||
{
|
{
|
||||||
/// Start listening for incomming connections from a stream.
|
/// Start listening for incoming connections from a stream.
|
||||||
///
|
///
|
||||||
/// This method uses only one thread for handling incoming connections.
|
/// This method uses only one thread for handling incoming connections.
|
||||||
pub fn start_incoming<S>(mut self, stream: S, secure: bool) -> SyncAddress<Self>
|
pub fn start_incoming<S>(mut self, stream: S, secure: bool) -> SyncAddress<Self>
|
||||||
@ -663,7 +663,7 @@ fn start_accept_thread(sock: net::TcpListener, addr: net::SocketAddr, backlog: i
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start listening for incommin commands
|
// Start listening for incoming commands
|
||||||
if let Err(err) = poll.register(®, CMD,
|
if let Err(err) = poll.register(®, CMD,
|
||||||
mio::Ready::readable(), mio::PollOpt::edge()) {
|
mio::Ready::readable(), mio::PollOpt::edge()) {
|
||||||
panic!("Can not register Registration: {}", err);
|
panic!("Can not register Registration: {}", err);
|
||||||
|
10
src/test.rs
10
src/test.rs
@ -29,7 +29,7 @@ use server::{HttpServer, HttpHandler, IntoHttpHandler, ServerSettings};
|
|||||||
/// The `TestServer` type.
|
/// The `TestServer` type.
|
||||||
///
|
///
|
||||||
/// `TestServer` is very simple test server that simplify process of writing
|
/// `TestServer` is very simple test server that simplify process of writing
|
||||||
/// integrational tests cases for actix web applications.
|
/// integration tests cases for actix web applications.
|
||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
@ -61,7 +61,7 @@ impl TestServer {
|
|||||||
|
|
||||||
/// Start new test server
|
/// Start new test server
|
||||||
///
|
///
|
||||||
/// This methos accepts configuration method. You can add
|
/// This method accepts configuration method. You can add
|
||||||
/// middlewares or set handlers for test application.
|
/// middlewares or set handlers for test application.
|
||||||
pub fn new<F>(config: F) -> Self
|
pub fn new<F>(config: F) -> Self
|
||||||
where F: Sync + Send + 'static + Fn(&mut TestApp<()>),
|
where F: Sync + Send + 'static + Fn(&mut TestApp<()>),
|
||||||
@ -101,7 +101,7 @@ impl TestServer {
|
|||||||
|
|
||||||
/// Start new test server with custom application state
|
/// Start new test server with custom application state
|
||||||
///
|
///
|
||||||
/// This methos accepts state factory and configuration method.
|
/// This method accepts state factory and configuration method.
|
||||||
pub fn with_state<S, FS, F>(state: FS, config: F) -> Self
|
pub fn with_state<S, FS, F>(state: FS, config: F) -> Self
|
||||||
where S: 'static,
|
where S: 'static,
|
||||||
FS: Sync + Send + 'static + Fn() -> S,
|
FS: Sync + Send + 'static + Fn() -> S,
|
||||||
@ -287,12 +287,12 @@ impl Default for TestRequest<()> {
|
|||||||
|
|
||||||
impl TestRequest<()> {
|
impl TestRequest<()> {
|
||||||
|
|
||||||
/// Create TestReqeust and set request uri
|
/// Create TestRequest and set request uri
|
||||||
pub fn with_uri(path: &str) -> TestRequest<()> {
|
pub fn with_uri(path: &str) -> TestRequest<()> {
|
||||||
TestRequest::default().uri(path)
|
TestRequest::default().uri(path)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create TestReqeust and set header
|
/// Create TestRequest and set header
|
||||||
pub fn with_header<K, V>(key: K, value: V) -> TestRequest<()>
|
pub fn with_header<K, V>(key: K, value: V) -> TestRequest<()>
|
||||||
where HeaderName: HttpTryFrom<K>,
|
where HeaderName: HttpTryFrom<K>,
|
||||||
HeaderValue: HttpTryFrom<V>
|
HeaderValue: HttpTryFrom<V>
|
||||||
|
@ -28,7 +28,7 @@ pub(crate) struct Frame {
|
|||||||
|
|
||||||
impl Frame {
|
impl Frame {
|
||||||
|
|
||||||
/// Desctructe frame
|
/// Destruct frame
|
||||||
pub fn unpack(self) -> (bool, OpCode, Binary) {
|
pub fn unpack(self) -> (bool, OpCode, Binary) {
|
||||||
(self.finished, self.opcode, self.payload)
|
(self.finished, self.opcode, self.payload)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user