http-lite v0.2.1 MIT 15.2k - 211

Zero-allocation HTTP/1.1 parser and connection pool.

rnx add http-lite

http-lite

Zero-allocation HTTP/1.1 request parsing. The parser works over borrowed slices, so steady-state serving performs no ARC traffic.

Method dispatch

.rnx
enum Method { Get, Post, Unknown }

fn status(m: Method): Int {
    switch m {
        case .Get: return 200;
        case .Post: return 201;
        case .Unknown: return 400;
    }
}


print(status(Method.Get), status(Method.Unknown));

Connection accounting

.rnx
let open = 0;
let i = 0;
while i < 64 {
    open = open + 1;
    i = i + 1;
}
print(open);