2018-10-05 05:02:10 +02:00
|
|
|
//! HTTP/1 implementation
|
2018-10-14 08:57:31 +02:00
|
|
|
use actix_net::codec::Framed;
|
2018-10-23 03:18:05 +02:00
|
|
|
use bytes::Bytes;
|
2018-10-14 08:57:31 +02:00
|
|
|
|
2018-10-23 03:18:05 +02:00
|
|
|
mod client;
|
2018-10-05 05:02:10 +02:00
|
|
|
mod codec;
|
|
|
|
mod decoder;
|
|
|
|
mod dispatcher;
|
2018-10-05 19:03:10 +02:00
|
|
|
mod encoder;
|
2018-10-05 05:02:10 +02:00
|
|
|
mod service;
|
|
|
|
|
2018-10-23 03:18:05 +02:00
|
|
|
pub use self::client::ClientCodec;
|
|
|
|
pub use self::codec::Codec;
|
2018-10-08 16:55:01 +02:00
|
|
|
pub use self::decoder::{PayloadDecoder, RequestDecoder};
|
2018-10-05 05:02:10 +02:00
|
|
|
pub use self::dispatcher::Dispatcher;
|
2018-10-16 01:46:13 +02:00
|
|
|
pub use self::service::{H1Service, H1ServiceHandler, OneRequest};
|
2018-10-14 08:57:31 +02:00
|
|
|
|
|
|
|
use request::Request;
|
|
|
|
|
|
|
|
/// H1 service response type
|
|
|
|
pub enum H1ServiceResult<T> {
|
|
|
|
Disconnected,
|
|
|
|
Shutdown(T),
|
|
|
|
Unhandled(Request, Framed<T, Codec>),
|
|
|
|
}
|
2018-10-23 03:18:05 +02:00
|
|
|
|
|
|
|
#[derive(Debug)]
|
|
|
|
/// Codec message
|
|
|
|
pub enum Message<T> {
|
|
|
|
/// Http message
|
|
|
|
Item(T),
|
|
|
|
/// Payload chunk
|
|
|
|
Chunk(Option<Bytes>),
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<T> From<T> for Message<T> {
|
|
|
|
fn from(item: T) -> Self {
|
|
|
|
Message::Item(item)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Incoming request type
|
|
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
|
|
|
pub enum MessageType {
|
|
|
|
None,
|
|
|
|
Payload,
|
|
|
|
Unhandled,
|
|
|
|
}
|