api
types.ch
Declarations in types.ch
1 declarationshttp
Declarations
Public only
http#
Publicnamespace
namespace http
===== HTTP utilities and types =====
HeaderMap#
Publicstruct
strcasecmp#
Publicfunction
func strcasecmp(a : *char, b : *char) : int
helper: simple ASCII case-insensitive strcmp
Body#
Publicstruct
struct Body {
var sock : Socket
var buf : *Buffer
var remaining : isize
var chunked : bool
var timeout_secs : long
var max_body : usize
var closed : bool
var cur_chunk_left : usize
var seen_total : usize
var owns_buf : bool
var tls_ctx : *SSLContext
}
Body: lazy reader for request body. Does NOT close the socket by itself.
body_recv#
function
low-level recv helper that honors timeout and returns <=0 on error/timeout
copy_from_buffer#
function
Helper: copy up to `want` bytes from the already-read buffer into dst, returning copied count.
read#
PublicfunctionExtension
PUBLIC: read up to `cap` bytes into dst.
read_to_string#
PublicfunctionExtension
read all remaining body into a string
read_exact#
PublicfunctionExtension
read exactly `n` bytes
socket#
PublicfunctionExtension
Access to the underlying socket for consumers that need to inspect or
close_socket#
PublicfunctionExtension
func close_socket(b : &Body) : void
Close the underlying socket immediately. Subsequent reads return 0.
is_chunked#
PublicfunctionExtension
func is_chunked(b : &Body) : bool
True if the body uses Transfer-Encoding: chunked.
content_length#
PublicfunctionExtension
func content_length(b : &Body) : isize
Remaining body bytes when Content-Length was present, or -1 when the