Skip to main content

rust_web_server/http/
mod.rs

1#[cfg(test)]
2mod tests;
3
4pub struct Version {
5    pub http_0_9: &'static str,
6    pub http_1_0: &'static str,
7    pub http_1_1: &'static str,
8    pub http_2_0: &'static str,
9    pub http_3_0: &'static str,
10}
11
12pub const VERSION: Version = Version {
13    http_0_9: "HTTP/0.9",
14    http_1_0: "HTTP/1.0",
15    http_1_1: "HTTP/1.1",
16    http_2_0: "HTTP/2.0",
17    http_3_0: "HTTP/3.0",
18};
19
20pub struct HTTP;
21
22impl HTTP {
23    pub fn version_list() -> Vec<String> {
24        let version_0_9 = VERSION.http_0_9.to_string();
25        let version_1_0 = VERSION.http_1_0.to_string();
26        let version_1_1 = VERSION.http_1_1.to_string();
27        let version_2_0 = VERSION.http_2_0.to_string();
28        let version_3_0 = VERSION.http_3_0.to_string();
29
30        let list : Vec<String> = vec![
31            version_0_9,
32            version_1_0,
33            version_1_1,
34            version_2_0,
35            version_3_0,
36        ];
37        list
38    }
39}