sark-core 0.3.0

the L7 layer for dope
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
pub struct RawHttpResponse;

impl RawHttpResponse {
    pub fn build(status_line: &str, headers: &[(&str, &str)], body: &[u8]) -> Vec<u8> {
        let mut out = Vec::new();
        out.extend_from_slice(status_line.as_bytes());
        out.extend_from_slice(b"\r\n");
        for (name, value) in headers {
            out.extend_from_slice(name.as_bytes());
            out.extend_from_slice(b": ");
            out.extend_from_slice(value.as_bytes());
            out.extend_from_slice(b"\r\n");
        }
        out.extend_from_slice(b"\r\n");
        out.extend_from_slice(body);
        out
    }
}