refractium 3.0.3

Extensible low-level reverse proxy for port multiplexing and protocol-based routing
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//! HTTP protocol identification logic.

use crate::core::types::Transport;
use crate::define_protocol;

define_protocol!(
    /// HTTP protocol identification implementation.
    name: Http,
    transport: Transport::Tcp,
    identify: |data| {
        let verbs: &[&[u8]] = &[
            b"GET ", b"POST ", b"PUT ", b"DELETE ", b"HEAD ", b"OPTIONS ", b"CONNECT ", b"TRACE ", b"PATCH ",
        ];
        verbs.iter().any(|v| data.starts_with(v)) || data.starts_with(b"PRI * HTTP/2.0")
    }
);