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(Debug, Clone, Copy, PartialEq, Eq, Data, DisplayDebug, Deserialize, Serialize)]
9pub struct RequestConfig {
10    /// Buffer size for reading operations.
11    pub(super) buffer_size: usize,
12    /// Maximum length for HTTP request line in bytes.
13    pub(super) max_request_line_length: usize,
14    /// Maximum length for URL path in bytes.
15    pub(super) max_path_length: usize,
16    /// Maximum length for query string in bytes.
17    pub(super) max_query_length: usize,
18    /// Maximum length for a single header line in bytes.
19    pub(super) max_header_line_length: usize,
20    /// Maximum number of headers allowed in a request.
21    pub(super) max_header_count: usize,
22    /// Maximum length for a header key in bytes.
23    pub(super) max_header_key_length: usize,
24    /// Maximum length for a header value in bytes.
25    pub(super) max_header_value_length: usize,
26    /// Maximum size for request body in bytes.
27    pub(super) max_body_size: usize,
28    /// Maximum size for WebSocket frame in bytes.
29    pub(super) max_ws_frame_size: usize,
30    /// Maximum number of WebSocket frames to process in a single request.
31    pub(super) max_ws_frames: usize,
32    /// Timeout for reading HTTP request in milliseconds.
33    pub(super) http_read_timeout_ms: u64,
34    /// Timeout for reading WebSocket frames in milliseconds.
35    pub(super) ws_read_timeout_ms: u64,
36}
37
38/// HTTP request representation.
39///
40/// Contains all components of an HTTP request.
41#[derive(Debug, Clone, PartialEq, Eq, Getter, DisplayDebug)]
42pub struct Request {
43    /// HTTP request method.
44    pub(super) method: RequestMethod,
45    /// Request host.
46    pub(super) host: RequestHost,
47    /// HTTP protocol version.
48    pub(super) version: RequestVersion,
49    /// Request path.
50    pub(super) path: RequestPath,
51    /// URL query parameters.
52    pub(super) querys: RequestQuerys,
53    /// HTTP headers collection.
54    pub(super) headers: RequestHeaders,
55    /// Request body content.
56    pub(super) body: RequestBody,
57}