24 lines
588 B
Rust
24 lines
588 B
Rust
use http::Version;
|
|
use std::net::IpAddr;
|
|
|
|
pub struct RequestContext {
|
|
pub client_ip: IpAddr,
|
|
pub client_port: Option<u16>,
|
|
pub server_name: String,
|
|
pub server_port: u16,
|
|
pub tls: bool,
|
|
pub version: Version,
|
|
}
|
|
|
|
|
|
pub(super) fn server_protocol(version: http::Version) -> &'static str {
|
|
match version {
|
|
http::Version::HTTP_09 => "HTTP/0.9",
|
|
http::Version::HTTP_10 => "HTTP/1.0",
|
|
http::Version::HTTP_11 => "HTTP/1.1",
|
|
http::Version::HTTP_2 => "HTTP/2.0",
|
|
http::Version::HTTP_3 => "HTTP/3.0",
|
|
_ => "HTTP/1.1",
|
|
}
|
|
}
|