vanilla_http_server.request_parser #
fn decode_http_request #
fn decode_http_request(buffer []u8) !HttpRequest
decode_http_request decodes an HTTP request from a byte buffer. It parses the request line and populates the HttpRequest struct with method, path, and version.
fn slice_to_string #
fn slice_to_string(buffer []u8, s Slice) string
Helper function to convert Slice to string for debugging
struct HttpRequest #
struct HttpRequest {
pub mut:
buffer []u8
method Slice
path Slice
version Slice
}
fn (HttpRequest) get_header_value_slice #
fn (req HttpRequest) get_header_value_slice(name string) ?Slice
get_header_value_slice retrieves the value of a header from the HTTP request buffer. It searches for the header name in the request buffer and returns its value as a Slice.
struct Slice #
struct Slice {
pub:
start int
len int
}