pulse_http 0.2.0

Async HTTP/1.1 framework on Tokio — raw TCP, routing, middleware, no Hyper
Documentation
1
2
3
4
5
6
7
8
9
10
use crate::errors::ParseError;

pub fn parse_header_line(line: &str) -> Result<(String, String), ParseError> {
    let (name, value) = line.split_once(':').ok_or(ParseError::InvalidHeaderLine)?;
    let name = name.trim();
    if name.is_empty() || name.contains(' ') {
        return Err(ParseError::EmptyHeaderName);
    }
    Ok((name.to_ascii_lowercase(), value.trim().to_string()))
}