pub mod bytes;
pub mod http_request;
pub mod http_response;
pub mod http_stream;
pub mod zero_copy;
use std::collections::HashMap;
pub trait GetHeaderChild {
fn get_header_child(&self) -> HashMap<&str, &str>;
}
impl GetHeaderChild for &str {
fn get_header_child(&self) -> HashMap<&str, &str> {
let mut headers = HashMap::new();
for part in self.split(';') {
let part = part.trim();
if let Some(eq_pos) = part.find('=') {
let key = part[..eq_pos].trim();
let value = part[eq_pos + 1..]
.trim()
.trim_matches('"')
.trim_matches('\'');
headers.insert(key, value);
}
}
headers
}
}
pub trait StringUtil {
fn copy_string(&self) -> String;
}
impl StringUtil for String {
fn copy_string(&self) -> String {
self.clone()
}
}
pub use crate::helpers::traits::bytes::find_header_end as find_header_end_optimized;