http_type/request/
struct.rs

1use crate::*;
2
3/// Configuration for HTTP request parsing security limits.
4///
5/// This struct defines various limits and constraints to prevent
6/// denial-of-service attacks and other security vulnerabilities
7/// when parsing HTTP requests.
8#[derive(
9    Debug,
10    Clone,
11    Copy,
12    PartialEq,
13    Eq,
14    Getter,
15    GetterMut,
16    Setter,
17    DisplayDebug,
18    Deserialize,
19    Serialize,
20)]
21pub struct RequestConfig {
22    /// Buffer size for reading operations.
23    pub(super) buffer_size: usize,
24    /// Maximum length for HTTP request line in bytes.
25    pub(super) max_request_line_length: usize,
26    /// Maximum length for URL path in bytes.
27    pub(super) max_path_length: usize,
28    /// Maximum length for query string in bytes.
29    pub(super) max_query_length: usize,
30    /// Maximum length for a single header line in bytes.
31    pub(super) max_header_line_length: usize,
32    /// Maximum number of headers allowed in a request.
33    pub(super) max_header_count: usize,
34    /// Maximum length for a header key in bytes.
35    pub(super) max_header_key_length: usize,
36    /// Maximum length for a header value in bytes.
37    pub(super) max_header_value_length: usize,
38    /// Maximum size for request body in bytes.
39    pub(super) max_body_size: usize,
40    /// Maximum size for WebSocket frame in bytes.
41    pub(super) max_ws_frame_size: usize,
42    /// Maximum number of WebSocket frames to process in a single request.
43    pub(super) max_ws_frames: usize,
44    /// Timeout for reading HTTP request in milliseconds.
45    pub(super) http_read_timeout_ms: u64,
46    /// Timeout for reading WebSocket frames in milliseconds.
47    pub(super) ws_read_timeout_ms: u64,
48}
49
50/// HTTP request representation.
51///
52/// Contains all components of an HTTP request.
53#[derive(Debug, Clone, PartialEq, Eq, Getter, DisplayDebug)]
54pub struct Request {
55    /// HTTP request method.
56    pub(super) method: RequestMethod,
57    /// Request host.
58    pub(super) host: RequestHost,
59    /// HTTP protocol version.
60    pub(super) version: RequestVersion,
61    /// Request path.
62    pub(super) path: RequestPath,
63    /// URL query parameters.
64    pub(super) querys: RequestQuerys,
65    /// HTTP headers collection.
66    pub(super) headers: RequestHeaders,
67    /// Request body content.
68    pub(super) body: RequestBody,
69}