1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//! HTTP Server implementation
//!
//! Currently there is only HTTP/1.x implementation. We want to provide
//! HTTP/2.0 and HTTPS
//!
use TryAccept;
pub use ;
pub use RecvMode;
pub use Version;
pub use BodyKind;
pub use Parser;
pub use Server;
pub use Head;
pub use Response;
pub use ;
// TODO(tailhook) MAX_HEADERS_SIZE can be moved to Protocol
// (i.e. made non-constant), but it's more of a problem for MAX_HEADERS_NUM
// because that would mean we can't allocate array of headers on the stack
// so performance will degrade. Customizing MAX_HEADERS_SIZE is not very
// useful on it's own
/// The maximum allowed number of headers in a request.
///
/// Note httparse requires we preallocate array of this size so be wise.
pub const MAX_HEADERS_NUM: usize = 256;
/// The maximum size of request headers in bytes.
///
/// This one is not preallocated, but too large buffer is of limited use
/// because of `MAX_HEADERS_NUM` parameter.
pub const MAX_HEADERS_SIZE: usize = 16384;
/// The maximum length of chunk size line in bytes.
///
/// It would be okay with 12 bytes, but in theory there might be some extensions
/// which we skip. Note that the header is also used for padding.
///
/// Note: we don't have a limit on chunk body size. In buffered request mode
/// it's limited by either memory or artificial limit returned from handler.
/// In unbuffered mode we can process chunk of unlimited size as long as
/// request handler is able to handle it.
pub const MAX_CHUNK_HEAD: usize = 128;
/// Shortcut type for server state machines.
pub type Fsm<M, L> = ;