Skip to content

picohttpparser #

Description:

picohttpparser is a thin wrapper over picohttpparser, which in turn is "a tiny, primitive, fast HTTP request/response parser."

fn cmp #

fn cmp(dst string, src string) bool

fn cmpn #

fn cmpn(dst string, src string, n int) bool

struct Request #

struct Request {
mut:
	prev_len int
pub mut:
	method      string
	path        string
	headers     [100]C.phr_header
	num_headers u64
	body        string
}

fn (Request) parse_request #

fn (mut r Request) parse_request(s string, max_headers int) int

fn (Request) parse_request_path #

fn (mut r Request) parse_request_path(s string) int

fn (Request) parse_request_path_pipeline #

fn (mut r Request) parse_request_path_pipeline(s string) int

struct Response #

struct Response {
	fd int
pub:
	date      &u8 = unsafe { nil }
	buf_start &u8 = unsafe { nil }
pub mut:
	buf &u8 = unsafe { nil }
}

fn (Response) write_string #

fn (mut r Response) write_string(s string)

fn (Response) http_ok #

fn (mut r Response) http_ok() &Response

fn (Response) header #

fn (mut r Response) header(k string, v string) &Response

fn (Response) header_date #

fn (mut r Response) header_date() &Response

fn (Response) header_server #

fn (mut r Response) header_server() &Response

fn (Response) content_type #

fn (mut r Response) content_type(s string) &Response

fn (Response) html #

fn (mut r Response) html() &Response

fn (Response) plain #

fn (mut r Response) plain() &Response

fn (Response) json #

fn (mut r Response) json() &Response

fn (Response) body #

fn (mut r Response) body(body string)

fn (Response) http_404 #

fn (mut r Response) http_404()

fn (Response) http_405 #

fn (mut r Response) http_405()

fn (Response) http_500 #

fn (mut r Response) http_500()

fn (Response) raw #

fn (mut r Response) raw(response string)

fn (Response) end #

fn (mut r Response) end() int