octane 0.1.2

A web server built from the ground up.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use crate::http::{KeepAliveState, Validator};
use crate::responder::StatusCode;

pub fn http11_check(validator: &mut Validator) {
    if let None = validator.request.headers.get("host") {
        validator.set(StatusCode::BadRequest)
    }
    if let Some(connection_type) = validator.request.headers.get("connection") {
        if connection_type == "keep-alive" {
            validator.set_keepalive(KeepAliveState::UserDefined);
        } else if connection_type == "close" {
            validator.set_keepalive(KeepAliveState::Close)
        }
    }
}