CURLOPT_URL
pub val CURLOPT_URL = 10002extern (C) fn curl_easy_init() ref void = trust { ... } = "curl_easy_init"extern (C) fn curl_easy_cleanup(handle: ref void) void = trust { ... } = "curl_easy_cleanup"extern (C) fn curl_easy_setopt(handle: ref void, opt: i32, ...) i64 = trust { ... } = "curl_easy_setopt"extern (C) fn curl_easy_perform(handle: ref void) i64 = trust { ... } = "curl_easy_perform"extern (C) fn curl_easy_getinfo(handle: ref void, info: i32, ...) i64 = trust { ... } = "curl_easy_getinfo"extern (C) fn curl_slist_append(list: ref void, str: ref u8) ref void = trust { ... } = "curl_slist_append"extern (C) fn curl_slist_free_all(list: ref void) void = trust { ... } = "curl_slist_free_all"extern (C) fn curl_global_init(flags: i64) i64 = trust { ... } = "curl_global_init"extern (C) fn curl_global_cleanup() void = trust { ... } = "curl_global_cleanup"extern (C, header) fn InternetOpenA(agent: ref u8, access: u32, proxy: ref u8, bypass: ref u8, flags: u32) ref void = trust { ... } = "InternetOpenA"extern (C, header) fn InternetConnectA(handle: ref void, server: ref u8, port: u16, user: ref u8, password: ref u8, service: u32, flags: u32, context: usize) ref void = trust { ... } = "InternetConnectA"extern (C, header) fn HttpOpenRequestA(handle: ref void, verb: ref u8, path: ref u8, version: ref u8, referrer: ref void, accept: ref void, flags: u32, context: usize) ref void = trust { ... } = "HttpOpenRequestA"extern (C, header) fn HttpSendRequestA(handle: ref void, headers: ref u8, headers_len: u32, optional: ref void, optional_len: u32) i32 = trust { ... } = "HttpSendRequestA"extern (C, header) fn HttpQueryInfoA(handle: ref void, info: u32, buf: ref void, len: ref u32, index: ref u32) i32 = trust { ... } = "HttpQueryInfoA"extern (C, header) fn InternetReadFile(handle: ref void, buf: ref void, len: u32, read: ref u32) i32 = trust { ... } = "InternetReadFile"extern (C, header) fn InternetCloseHandle(handle: ref void) i32 = trust { ... } = "InternetCloseHandle"pub val CURLOPT_URL = 10002pub val CURLOPT_WRITEFUNCTION = 20011pub val CURLOPT_WRITEDATA = 10001pub val CURLOPT_HTTPHEADER = 10023pub val CURLOPT_POSTFIELDS = 10015pub val CURLOPT_POSTFIELDSIZE = 60pub val CURLOPT_CUSTOMREQUEST = 10036pub val CURLOPT_FOLLOWLOCATION = 52pub val CURLOPT_MAXREDIRS = 68pub val CURLINFO_RESPONSE_CODE = 2097154pub val CURL_GLOBAL_DEFAULT = 3type Buffer = { data: mut ref void, len: mut i64, cap: mut i64, failed: mut bool }| Name | Type |
|---|---|
data | mut ref void |
len | mut i64 |
cap | mut i64 |
failed | mut bool |
type Response = { body: mut ref u8, status: mut i64, len: mut i64 }An owned HTTP response.
| Name | Type |
|---|---|
body | mut ref u8 |
status | mut i64 |
len | mut i64 |
type I32Slot = { value: mut i32 }| Name | Type |
|---|---|
value | mut i32 |
type I64Slot = { value: mut i64 }| Name | Type |
|---|---|
value | mut i64 |
type WinUrl = { secure: mut bool, host: mut ref u8, port: mut u16, path: mut ref u8 }| Name | Type |
|---|---|
secure | mut bool |
host | mut ref u8 |
port | mut u16 |
path | mut ref u8 |
type WinHeader = { next: mut ref void, value: mut ref u8 }| Name | Type |
|---|---|
next | mut ref void |
value | mut ref u8 |
fn buf_new() ref Buffer = trust { ... }fn buf_append(buf: mut ref Buffer, data: ref void, total: i64) bool = trust { ... }pub fn curl_write_cb(ptr: ref void, size: i64, nmemb: i64, userdata: ref void) i64 = trust { ... }Internal write callback for curl. Signature matches: size_t write_fn(u8 *ptr, size_t size, size_t nmemb, void *userdata)
fn response_new[A: allocators.GeneralAllocator](ac: A, status: i64, body_ptr: ref void, body_len: i64) ref ResponseAllocate a Response from a raw body using the provided allocator.
fn do_request[A: allocators.GeneralAllocator](ac: A, handle: ref void) ref Responsefn win_char(s: ref u8, i: i64) u8 = trust { ... }fn win_url_free(url: ref WinUrl) void = trust { ... }fn win_parse_url(url: ref u8) ref WinUrl = trust { ... }Parse an http:// or https:// URL into the pieces WinINet needs.
fn win_header_new(value: ref u8) ref void = trust { ... }fn win_header_append(list: ref void, value: ref u8) ref void = trust { ... }fn win_header_free(list: ref void) void = trust { ... }fn win_headers_build(list: ref void) ref u8 = trust { ... }Join our header list into the CRLF-separated block WinINet expects.
fn win_query_status(handle: ref void) i64 = trust { ... }fn win_do_request[A: allocators.GeneralAllocator](ac: A, method: ref u8, url: ref u8, body: ref u8, header_list: ref void) ref ResponsePerform an HTTP request with WinINet. Returns a Response allocated with the provided allocator.
type Http = { }pub fn (Http) init() voidInitialise the HTTP client global state. Call once at program start.
pub fn (Http) cleanup() void = trust { ... }Clean up the HTTP client global state. Call once at program end.
pub fn (Http) get[A: allocators.GeneralAllocator](ac: A, url: ref u8) ref ResponsePerform an HTTP GET request. Returns a Response allocated with the provided allocator; caller must call Http.free_response().
pub fn (Http) post_request[A: allocators.GeneralAllocator](ac: A, url: ref u8, body: ref u8, content_type: ref u8) ref ResponsePerform an HTTP POST request with a body str. Returns a Response allocated with the provided allocator; caller must call Http.free_response().
pub fn (Http) request[A: allocators.GeneralAllocator](ac: A, method: ref u8, url: ref u8, body: ref u8, headers: ref void) ref ResponsePerform an arbitrary HTTP request (GET, POST, PUT, DELETE, PATCH …).
pub fn (Http) free_response[A: allocators.GeneralAllocator](ac: A, resp: ref Response) voidFree a Response returned by Http.get / Http.post / Http.request with the same allocator used to create it.
pub fn (Http) status(resp: ref Response) i64Read the HTTP status code from a Response.
pub fn (Http) body(resp: ref Response) ref u8Read the body pointer from a Response.
pub fn (Http) body_len(resp: ref Response) i64Read the body length from a Response.
pub fn (Http) make_headers(header: ref u8) ref void = trust { ... }Build a header list from a single "Key: Value" str.
pub fn (Http) append_header(list: ref void, header: ref u8) ref void = trust { ... }Append a header to an existing header list.
pub fn (Http) free_headers(list: ref void) void = trust { ... }Free a header list created with Http.make_headers / Http.append_header.